Female reproductive strategies in orangutans, evidence for female choice and counterstrategies to infanticide in a species with frequent sexual coercion

Cheryl D Knott, Melissa Emery Thompson, Rebecca M Stumpf and Matthew H McIntyre

The paper can be accessed here

Summary of Paper

Orangutans have exceptionally high rates of forced copulations. Traditionally, it was assumed that this was a strategy used by unflanged males, who are sexually mature but have not developed secondary sexual characteristics like prime males who have large cheek flanges. Little thought was given to how female strategies may have shaped or responded to this behavior. Knott et al. (2010) found that male morph alone was not a good predictor of mating dynamics among wild Bornean orangutans (Pongo pygmaeus wurmbii), but rather female conception risk mediated the occurence of male-female interactions.

This is a flanged male orangutan named Codet.

This is an adult female, Delly, with her infant Duwyk.

Knott et al. (2010) assayed urine samples and compared ovarian hormone profiles with the sexual behavior of females and males in order to understand the females’ ovulatory cycles (as they do not have obvious sexual swellings). Behavioral data was collected from 1994-2003 at the Cabang Panti Research Site in Gunung Palung National Park, West Kalimantan, Indonesia. During the 45,500 hours of observation, 387 encounters occured between males and females. Of these, male and female reproductive status could be determined for 153 encounters. 21 matings (between 10 males and 7 females) were observed during these encounters. They found that females were more likely to mate cooperatively with prime flanged males near ovulation, while they were more willing to associate and mate with non-prime males when conception risk was low.

Bornean orangutans live in lowland rainforests.

Bornean orangutans live in lowland rainforests.

(all photos are from the Gunung Palung Conservation website)

Prerequisites

First, I loaded in the required packages.

library(curl)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(stats)
library(AICcmodavg)
library(knitr)
library(broom)
library(graphics)
library(lme4)
## Loading required package: Matrix
## 
## Attaching package: 'lme4'
## The following object is masked from 'package:AICcmodavg':
## 
##     checkConv

Obtaining the Data

I first recieved this data in various files of .sav format, as it had been exported from SPSS. I was able to open the files in R using the “foreign” package and the command read.spss, though I decided it would be easier to manipulate the data if it were in a .csv file, as I am more familiar with this. I was able to do this online using this website where you can upload a .sav file and then download the corresponding .csv file. The files are available in my Github repository titled “data-reanalysis-assignment.” First, I loaded in the main csv file, which contains all of the compiled data.

# getting the data into R
library(curl)
f <- curl("https://raw.githubusercontent.com/natalierobinson96/data-reanalysis-assignment/master/matings%20with%20endocrine%20data.csv")
d <- read.csv(f, header = TRUE, sep = ",")
head(d)
##    Date day year    year2 DateSPSS     Name   Name2 Record.
## 1 33193 321   90 90.87748 11/17/90  Kristen Kristen       7
## 2 33194 322   90 90.88022 11/18/90  Kristen Kristen       8
## 3 33194 322   90 90.88022 11/18/90  Kristen Kristen       9
## 4 33248  10   91 91.02806  1/10/91 Female A Afemale      10
## 5 33257  19   91 91.05270  1/19/91     Beth    Beth      11
## 6 33878 275   92 92.75291  10/1/92  Marissa Marissa      20
##   TypeofInteraction FemaleAgeclass FemaleMotherClass OffspringClass
## 1          Mating 1   Adult Female            Mother     Over 4 yrs
## 2          Mating 1   Adult Female            Mother     Over 4 yrs
## 3          Mating 2   Adult Female            Mother     Over 4 yrs
## 4          Mating 1   Adult Female        Non-mother      No infant
## 5          Mating 1   Adult Female        Non-mother      No infant
## 6          Mating 1   Adult Female            Mother     Over 4 yrs
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                   Pregnant                                           
## 2                   Pregnant                                           
## 3                   Pregnant                                           
## 4                   Pregnant                                           
## 5                   Pregnant                                           
## 6                         L7                                           
##   ReproductiveStatus       Endo2    Endo3    Endo4    Endo5    Endo6
## 1           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 2           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 3           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 4           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 5           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 6            Cycling     non-POP  non-POP  non-POP  non-POP  non-POP
##     Endo7    Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1 non-POP Pregnant               Pregnant      NA      NA         NA
## 2 non-POP Pregnant               Pregnant      NA      NA         NA
## 3 non-POP Pregnant               Pregnant      NA      NA         NA
## 4 non-POP Pregnant               Pregnant      NA      NA         NA
## 5 non-POP Pregnant               Pregnant      NA      NA         NA
## 6 non-POP  non-POP               Non-Preg      NA      NA         NA
##                                                                                EndorineComment
## 1 Pregnant as of 22 Nov 94, no sample this date: could be pregnant already or conceptive cycle
## 2 Pregnant as of 22 Nov 94, no sample this date: could be pregnant already or conceptive cycle
## 3 Pregnant as of 22 Nov 94, no sample this date: could be pregnant already or conceptive cycle
## 4                                                    Pregnant based on CK\032s analysis of E1C
## 5                                                                                   High E & P
## 6                                                   ovulation occurs 15-17 Oct -- see attached
##   SocialInteraction InteractionwithMale Mating NearMating Consortship
## 1                 Y                   Y      Y          N           Y
## 2                 Y                   Y      Y          N           Y
## 3                 Y                   Y      Y          N           Y
## 4                 Y                   Y      Y          N           Y
## 5                 Y                   Y      Y                      Y
## 6                 Y                   Y      Y          N           N
##   ObservationMinutes             FollowType FollowTypeII Lengthofmating
## 1                 NA             N  No data                    0.009028
## 2                424                H  lost            M       0.004861
## 3                424                H  lost            M       0.021528
## 4                617                H  lost            H       0.004861
## 5                743                F  full            F       0.015972
## 6                281 D  found then full day            D       0.006250
##   PelvicThrusts       Male MaletypeI MaleTypeII MaleTypeIII
## 1            NA     Male V Unflanged  Unflanged   Non-Prime
## 2            NA     Male V Unflanged  Unflanged   Non-Prime
## 3            NA     Male V Unflanged  Unflanged   Non-Prime
## 4            NA Subadult T Unflanged  Unflanged   Non-Prime
## 5            NA       Phil Unflanged  Unflanged   Non-Prime
## 6            NA UML02Oct96 Unflanged  Unflanged   Non-Prime
##   MatingTypeExcel MatingTypePercent MatingTypePercentII MatingTypeII
## 1     Cooperative       Cooperative         Cooperative     Unforced
## 2     Cooperative           No Data         Cooperative     Unforced
## 3     Cooperative       Cooperative         Cooperative     Unforced
## 4     Cooperative       Cooperative         Cooperative     Unforced
## 5     Cooperative       Cooperative         Cooperative     Unforced
## 6          Forced            Forced              Forced       Forced
##   MatingTypeIII Matingtypequestionable
## 1    Proceptive                     No
## 2    Unresisted                     No
## 3    Proceptive                     No
## 4    Unresisted                     No
## 5    Proceptive                     No
## 6      Resisted                     No
##   TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                 2
## 2                                                NA
## 3                                                 2
## 4                                                 1
## 5                                                 4
## 6                                                 2
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                           1                          NA
## 2                          NA                          NA
## 3                           1                          NA
## 4                           1                          NA
## 5                          NA                          NA
## 6                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                          1                   0.5                   1
## 2                         NA                    NA                  NA
## 3                          1                   0.5                   1
## 4                          1                   1.0                  NA
## 5                         NA                   0.0                   4
## 6                         NA                   0.0                  NA
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                   0.5                                      2
## 2                    NA                                     NA
## 3                   0.5                                      2
## 4                   0.0                                      1
## 5                   1.0                                      4
## 6                   0.0                                     NA
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                                 1                       NA
## 2                                NA                       NA
## 3                                 1                       NA
## 4                                 1                       NA
## 5                                 1                       NA
## 6                                 0                       NA
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1               0                       NA               0
## 2              NA                       NA              NA
## 3               0                       NA               0
## 4               0                       NA               0
## 5               0                       NA               0
## 6               0                        2               1
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                      NA                  0                   1        1
## 2                      NA                 NA                  NA        1
## 3                      NA                  0                  NA        1
## 4                      NA                  0                   1        1
## 5                      NA                  0                  NA        1
## 6                       2                  1                   1        1
##   POP preg lact prime past unflanged included endomiss
## 1   0    1    0     0    0         1        1        0
## 2   0    1    0     0    0         1        1        0
## 3   0    1    0     0    0         1        1        0
## 4   0    1    0     0    0         1        1        0
## 5   0    1    0     0    0         1        1        0
## 6   0    0    0     0    0         1        1        0

Figure 1 (Descriptive)

First I replicated Figure 1 from the paper. This figure shows the distribution of matings with respect to male type and female ovulatory status.

First I created 3 variables of female mating type. Each female was either pregnant, in the periovulatory period, or neither (non-periovulatory).

nonPOP <- filter(d, preg == "0" & POP == "0")
nonPOP #matings with females not in periovulatory period; currently cycling
##    Date day year    year2 DateSPSS      Name     Name2 Record.
## 1 33878 275   92 92.75291  10/1/92   Marissa   Marissa      20
## 2 34061  93   93 93.25394   4/3/93   Marissa   Marissa      22
## 3 34340   7   94 94.01780   1/7/94 Elizabeth Elizabeth      31
## 4 34343  10   94 94.02601  1/10/94    Zarina    Zarina      35
## 5 34344  11   94 94.02875  1/11/94    Zarina    Zarina      41
## 6 36210  50   99 99.13758  2/19/99   Kristen   Kristen      78
##   TypeofInteraction FemaleAgeclass FemaleMotherClass OffspringClass
## 1          Mating 1   Adult Female            Mother     Over 4 yrs
## 2          Mating 1   Adult Female            Mother     Over 4 yrs
## 3          Mating 1   Adult Female            Mother     Inf no juv
## 4          Mating 1   Adult Female            Mother     Over 4 yrs
## 5          Mating 1   Adult Female            Mother     Over 4 yrs
## 6          Mating 1   Adult Female            Mother    Inf ind juv
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                         L7                                           
## 2                         L8                                           
## 3                         L4                                           
## 4                                                                      
## 5                                                                      
## 6                         L1                                           
##   ReproductiveStatus       Endo2   Endo3   Endo4   Endo5     Endo6   Endo7
## 1            Cycling     non-POP non-POP non-POP non-POP   non-POP non-POP
## 2            Cycling     non-POP non-POP non-POP non-POP   non-POP non-POP
## 3            Cycling     non-POP Cycling     POP     POP  Near-POP     POP
## 4            Cycling     non-POP non-POP non-POP non-POP   non-POP non-POP
## 5            Cycling     non-POP non-POP non-POP non-POP   non-POP non-POP
## 6          Lactating non-cycling non-POP non-POP non-POP Lactating No Data
##     Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1 non-POP               Non-Preg      NA      NA         NA
## 2 non-POP               Non-Preg      NA      NA         NA
## 3 non-POP               Non-Preg      NA      NA         NA
## 4 non-POP               Non-Preg      NA      NA         NA
## 5 non-POP               Non-Preg      NA      NA         NA
## 6 No Data               Non-Preg      NA      NA         NA
##                                                                 EndorineComment
## 1                                    ovulation occurs 15-17 Oct -- see attached
## 2                                                              mid-luteal phase
## 3 High P 6 Jan-16 Jan, no data when E peak occurred, looks just after ovulation
## 4                                        Ovulation occurs between 1/16 and 1/22
## 5                                        Ovulation occurs between 1/16 and 1/22
## 6                                                                              
##   SocialInteraction InteractionwithMale Mating NearMating Consortship
## 1                 Y                   Y      Y          N           N
## 2                 Y                   Y      Y          N           N
## 3                 Y                   Y      Y          N           Y
## 4                 Y                   Y      Y          N           Y
## 5                 Y                   Y      Y          N           Y
## 6                 Y                   Y      Y          N           N
##   ObservationMinutes             FollowType FollowTypeII Lengthofmating
## 1                281 D  found then full day            D       0.006250
## 2                700                F  full            F       0.006053
## 3                785       L  late full day            F       0.001389
## 4                815                F  full            F       0.001273
## 5                820                F  full            F       0.003299
## 6                253 D  found then full day                    0.002894
##   PelvicThrusts       Male MaletypeI MaleTypeII MaleTypeIII
## 1            NA UML02Oct96 Unflanged  Unflanged   Non-Prime
## 2            NA UML03Apr97 Unflanged  Unflanged   Non-Prime
## 3            10     Gagung Unflanged  Unflanged   Non-Prime
## 4            NA       Toby Unflanged  Unflanged   Non-Prime
## 5            98       Toby Unflanged  Unflanged   Non-Prime
## 6            NA      Roman   Flanged Past Prime   Non-Prime
##   MatingTypeExcel MatingTypePercent MatingTypePercentII MatingTypeII
## 1          Forced            Forced              Forced       Forced
## 2          Forced            Forced              Forced       Forced
## 3     Cooperative       Cooperative         Cooperative     Unforced
## 4     Cooperative       Cooperative         Cooperative     Unforced
## 5          Forced            Forced              Forced       Forced
## 6          Forced            Forced              Forced     Unforced
##   MatingTypeIII Matingtypequestionable
## 1      Resisted                     No
## 2      Resisted                     No
## 3    Unresisted                     No
## 4    Unresisted                     No
## 5      Resisted                     No
## 6    Unresisted                    Yes
##   TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                 2
## 2                                                 4
## 3                                                 3
## 4                                                 1
## 5                                                 2
## 6                                                 5
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                          NA                          NA
## 2                          NA                           1
## 3                           1                          NA
## 4                           1                          NA
## 5                          NA                          NA
## 6                          NA                           1
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                         NA                  0.00                  NA
## 2                          1                  0.25                  NA
## 3                          1                  0.33                   1
## 4                          1                  1.00                  NA
## 5                         NA                  0.00                  NA
## 6                          1                  0.20                  NA
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                  0.00                                     NA
## 2                  0.00                                      1
## 3                  0.33                                      2
## 4                  0.00                                      1
## 5                  0.00                                     NA
## 6                  0.00                                      1
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                              0.00                       NA
## 2                              0.25                        1
## 3                              0.67                        1
## 4                              1.00                       NA
## 5                              0.00                        1
## 6                              0.20                        4
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1            0.00                        2             1.0
## 2            0.25                        2             0.5
## 3            0.33                       NA             0.0
## 4            0.00                       NA             0.0
## 5            0.50                        1             0.5
## 6            0.80                       NA             0.0
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                       2               1.00                   1        1
## 2                       3               0.75                  NA        1
## 3                       1               0.33                   3        1
## 4                      NA               0.00                  NA        1
## 5                       2               1.00                   1        1
## 6                       4               0.80                   1        1
##   POP preg lact prime past unflanged included endomiss
## 1   0    0    0     0    0         1        1        0
## 2   0    0    0     0    0         1        1        0
## 3   0    0    0     0    0         1        1        0
## 4   0    0    0     0    0         1        1        0
## 5   0    0    0     0    0         1        1        0
## 6   0    0    1     0    1         0        1        0
pregnant <- filter(d, preg == "1")
pregnant #matings with pregnant females 
##    Date day year    year2 DateSPSS     Name   Name2 Record.
## 1 33193 321   90 90.87748 11/17/90  Kristen Kristen       7
## 2 33194 322   90 90.88022 11/18/90  Kristen Kristen       8
## 3 33194 322   90 90.88022 11/18/90  Kristen Kristen       9
## 4 33248  10   91 91.02806  1/10/91 Female A Afemale      10
## 5 33257  19   91 91.05270  1/19/91     Beth    Beth      11
## 6 35764 335   97 97.91650  12/1/97    Kayla   Kayla      73
## 7 35765 336   97 97.91923  12/2/97    Kayla   Kayla      75
## 8 35766 337   97 97.92197  12/3/97    Kayla   Kayla      76
##   TypeofInteraction FemaleAgeclass FemaleMotherClass OffspringClass
## 1          Mating 1   Adult Female            Mother     Over 4 yrs
## 2          Mating 1   Adult Female            Mother     Over 4 yrs
## 3          Mating 2   Adult Female            Mother     Over 4 yrs
## 4          Mating 1   Adult Female        Non-mother      No infant
## 5          Mating 1   Adult Female        Non-mother      No infant
## 6          Mating 1   Adult Female        Non-mother      No infant
## 7          Mating 1   Adult Female        Non-mother      No infant
## 8          Mating 1   Adult Female        Non-mother      No infant
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                   Pregnant                                           
## 2                   Pregnant                                           
## 3                   Pregnant                                           
## 4                   Pregnant                                           
## 5                   Pregnant                                           
## 6                   Pregnant                                           
## 7                   Pregnant                                           
## 8                   Pregnant                 cycling           Not sure
##   ReproductiveStatus       Endo2    Endo3    Endo4    Endo5    Endo6
## 1           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 2           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 3           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 4           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 5           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 6           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 7           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 8           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
##     Endo7    Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1 non-POP Pregnant               Pregnant      NA      NA         NA
## 2 non-POP Pregnant               Pregnant      NA      NA         NA
## 3 non-POP Pregnant               Pregnant      NA      NA         NA
## 4 non-POP Pregnant               Pregnant      NA      NA         NA
## 5 non-POP Pregnant               Pregnant      NA      NA         NA
## 6 non-POP Pregnant               Pregnant      NA      NA         NA
## 7 non-POP Pregnant               Pregnant      NA      NA         NA
## 8 non-POP Pregnant               Pregnant      NA    2275         NA
##                                                                                EndorineComment
## 1 Pregnant as of 22 Nov 94, no sample this date: could be pregnant already or conceptive cycle
## 2 Pregnant as of 22 Nov 94, no sample this date: could be pregnant already or conceptive cycle
## 3 Pregnant as of 22 Nov 94, no sample this date: could be pregnant already or conceptive cycle
## 4                                                    Pregnant based on CK\032s analysis of E1C
## 5                                                                                   High E & P
## 6                                                                                             
## 7                                                                                             
## 8                                                                                             
##   SocialInteraction InteractionwithMale Mating NearMating Consortship
## 1                 Y                   Y      Y          N           Y
## 2                 Y                   Y      Y          N           Y
## 3                 Y                   Y      Y          N           Y
## 4                 Y                   Y      Y          N           Y
## 5                 Y                   Y      Y                      Y
## 6                 Y                   Y      Y          Y           Y
## 7                 Y                   Y      Y          N           Y
## 8                 Y                   Y      Y          N           Y
##   ObservationMinutes       FollowType FollowTypeII Lengthofmating
## 1                 NA       N  No data                    0.009028
## 2                424          H  lost            M       0.004861
## 3                424          H  lost            M       0.021528
## 4                617          H  lost            H       0.004861
## 5                743          F  full            F       0.015972
## 6                285 L  late full day                    0.006944
## 7                880          F  full            F       0.008333
## 8                815          F  full            F       0.002083
##   PelvicThrusts       Male MaletypeI MaleTypeII MaleTypeIII
## 1            NA     Male V Unflanged  Unflanged   Non-Prime
## 2            NA     Male V Unflanged  Unflanged   Non-Prime
## 3            NA     Male V Unflanged  Unflanged   Non-Prime
## 4            NA Subadult T Unflanged  Unflanged   Non-Prime
## 5            NA       Phil Unflanged  Unflanged   Non-Prime
## 6           374    Wendell   Flanged Prime Male       Prime
## 7           384    Wendell   Flanged Prime Male       Prime
## 8            NA    Wendell   Flanged Prime Male       Prime
##   MatingTypeExcel MatingTypePercent MatingTypePercentII MatingTypeII
## 1     Cooperative       Cooperative         Cooperative     Unforced
## 2     Cooperative           No Data         Cooperative     Unforced
## 3     Cooperative       Cooperative         Cooperative     Unforced
## 4     Cooperative       Cooperative         Cooperative     Unforced
## 5     Cooperative       Cooperative         Cooperative     Unforced
## 6     Cooperative       Cooperative         Cooperative     Unforced
## 7     Cooperative       Cooperative         Cooperative     Unforced
## 8                       Cooperative         Cooperative     Unforced
##   MatingTypeIII Matingtypequestionable
## 1    Proceptive                     No
## 2    Unresisted                     No
## 3    Proceptive                     No
## 4    Unresisted                     No
## 5    Proceptive                     No
## 6    Proceptive                     No
## 7    Proceptive                     No
## 8    Proceptive                     No
##   TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                 2
## 2                                                NA
## 3                                                 2
## 4                                                 1
## 5                                                 4
## 6                                                 4
## 7                                                 7
## 8                                                 5
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                           1                          NA
## 2                          NA                          NA
## 3                           1                          NA
## 4                           1                          NA
## 5                          NA                          NA
## 6                          NA                          NA
## 7                          NA                          NA
## 8                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                          1                   0.5                   1
## 2                         NA                    NA                  NA
## 3                          1                   0.5                   1
## 4                          1                   1.0                  NA
## 5                         NA                   0.0                   4
## 6                         NA                   0.0                   4
## 7                         NA                   0.0                   7
## 8                         NA                   0.0                   5
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                   0.5                                      2
## 2                    NA                                     NA
## 3                   0.5                                      2
## 4                   0.0                                      1
## 5                   1.0                                      4
## 6                   1.0                                      4
## 7                   1.0                                      7
## 8                   1.0                                      5
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                                 1                       NA
## 2                                NA                       NA
## 3                                 1                       NA
## 4                                 1                       NA
## 5                                 1                       NA
## 6                                 1                       NA
## 7                                 1                       NA
## 8                                 1                       NA
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1               0                       NA               0
## 2              NA                       NA              NA
## 3               0                       NA               0
## 4               0                       NA               0
## 5               0                       NA               0
## 6               0                       NA               0
## 7               0                       NA               0
## 8               0                       NA               0
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                      NA                  0                   1        1
## 2                      NA                 NA                  NA        1
## 3                      NA                  0                  NA        1
## 4                      NA                  0                   1        1
## 5                      NA                  0                  NA        1
## 6                      NA                  0                   2        1
## 7                      NA                  0                   5        1
## 8                      NA                  0                  NA        1
##   POP preg lact prime past unflanged included endomiss
## 1   0    1    0     0    0         1        1        0
## 2   0    1    0     0    0         1        1        0
## 3   0    1    0     0    0         1        1        0
## 4   0    1    0     0    0         1        1        0
## 5   0    1    0     0    0         1        1        0
## 6   0    1    0     1    0         0        1        0
## 7   0    1    0     1    0         0        1        0
## 8   0    1    0     1    0         0        1        0
POP <- filter(d, POP == "1")
POP #matings with females in periovulatory period
##    Date day year    year2 DateSPSS    Name   Name2 Record.
## 1 34318 350   93 93.95756 12/16/93 Marissa Marissa      26
## 2 34318 350   93 93.95756 12/16/93 Marissa Marissa      27
## 3 34340   7   94 94.01780   1/7/94 Marissa Marissa      30
## 4 34341   8   94 94.02053   1/8/94 Marissa Marissa      32
## 5 34343  10   94 94.02601  1/10/94 Marissa Marissa      39
## 6 34347  14   94 94.03696  1/14/94  Zarina  Zarina      42
## 7 34349  16   94 94.04244  1/16/94  Zarina  Zarina      45
##   TypeofInteraction FemaleAgeclass FemaleMotherClass OffspringClass
## 1          Mating 1   Adult Female            Mother     Over 4 yrs
## 2          Mating 2   Adult Female            Mother     Over 4 yrs
## 3          Mating 1   Adult Female            Mother     Over 4 yrs
## 4          Mating 1   Adult Female            Mother     Over 4 yrs
## 5          Mating 1   Adult Female            Mother     Over 4 yrs
## 6          Mating 1   Adult Female            Mother     Over 4 yrs
## 7          Mating 1   Adult Female            Mother     Over 4 yrs
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                         L8                 cycling                pop
## 2                         L8                 cycling                pop
## 3                                                                      
## 4                                                                      
## 5                                            cycling           near-pop
## 6                                                                      
## 7                                                                      
##   ReproductiveStatus    Endo2   Endo3 Endo4   Endo5    Endo6   Endo7
## 1            Cycling      POP Cycling   POP     POP      POP     POP
## 2            Cycling      POP Cycling   POP     POP      POP     POP
## 3            Cycling Near-POP Cycling   POP non-POP Near-POP non-POP
## 4            Cycling Near-POP Cycling   POP non-POP Near-POP non-POP
## 5            Cycling Near-POP Cycling   POP non-POP Near-POP non-POP
## 6            Cycling      POP Cycling   POP     POP      POP     POP
## 7            Cycling      POP Cycling   POP     POP      POP     POP
##     Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1     POP               Non-Preg   46754    1249         NA
## 2     POP               Non-Preg   46754    1249         NA
## 3 non-POP               Non-Preg      NA      NA         NA
## 4 non-POP               Non-Preg      NA      NA         NA
## 5 non-POP               Non-Preg   65153     891         NA
## 6     POP               Non-Preg      NA      NA         NA
## 7     POP               Non-Preg      NA      NA         NA
##                                        EndorineComment SocialInteraction
## 1       ovulation occurs approx 15-16 Dec see attached                 Y
## 2       ovulation occurs approx 15-16 Dec see attached                 Y
## 3 ovulation should occur approx 15-17 Jan see attached                 Y
## 4 ovulation should occur approx 15-17 Jan see attached                 Y
## 5 ovulation should occur approx 15-17 Jan see attached                 Y
## 6               Ovulation occurs between 1/16 and 1/22                 Y
## 7               Ovulation occurs between 1/16 and 1/22                 Y
##   InteractionwithMale Mating NearMating Consortship ObservationMinutes
## 1                   Y      Y          Y           Y                667
## 2                   Y      Y          Y           Y                667
## 3                   Y      Y          Y           N                806
## 4                   Y      Y          Y           Y                792
## 5                   Y      Y          Y           Y                770
## 6                   Y      Y          N           Y                795
## 7                   Y      Y          Y           Y                648
##   FollowType FollowTypeII Lengthofmating PelvicThrusts       Male
## 1    F  full            F       0.003785            NA Jari Manis
## 2    F  full            F       0.004074            NA Jari Manis
## 3    F  full            F       0.002743            NA Jari Manis
## 4    F  full            F       0.010266            NA Jari Manis
## 5    F  full            F       0.001910           224 Jari Manis
## 6    F  full            F       0.004086           261      Roman
## 7    H  lost                    0.009028           113 Jari Manis
##   MaletypeI MaleTypeII MaleTypeIII MatingTypeExcel MatingTypePercent
## 1   Flanged Prime Male       Prime     Cooperative       Cooperative
## 2   Flanged Prime Male       Prime     Cooperative       Cooperative
## 3   Flanged Prime Male       Prime          Forced            Forced
## 4   Flanged Prime Male       Prime          Forced       Cooperative
## 5   Flanged Prime Male       Prime          Forced            Forced
## 6   Flanged Past Prime   Non-Prime          Forced            Forced
## 7   Flanged Prime Male       Prime     Cooperative       Cooperative
##   MatingTypePercentII MatingTypeII MatingTypeIII Matingtypequestionable
## 1         Cooperative     Unforced    Unresisted                     No
## 2         Cooperative     Unforced    Unresisted                     No
## 3              Forced       Forced      Resisted                     No
## 4         Cooperative     Unforced    Unresisted                    Yes
## 5              Forced       Forced      Resisted                     No
## 6              Forced       Forced      Resisted                     No
## 7         Cooperative     Unforced    Proceptive                     No
##   TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                 1
## 2                                                 2
## 3                                                 3
## 4                                                 3
## 5                                                 3
## 6                                                 2
## 7                                                 6
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                           1                          NA
## 2                          NA                           1
## 3                          NA                           1
## 4                           1                           1
## 5                          NA                           1
## 6                          NA                          NA
## 7                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                          1                  1.00                  NA
## 2                          1                  0.50                  NA
## 3                          1                  0.33                  NA
## 4                          2                  0.67                  NA
## 5                          1                  0.33                  NA
## 6                         NA                  0.00                  NA
## 7                         NA                  0.00                   6
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                     0                                      1
## 2                     0                                      1
## 3                     0                                      1
## 4                     0                                      2
## 5                     0                                      1
## 6                     0                                     NA
## 7                     1                                      6
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                              1.00                       NA
## 2                              0.50                        1
## 3                              0.33                        1
## 4                              0.67                        1
## 5                              0.33                        1
## 6                              0.00                       NA
## 7                              1.00                       NA
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1            0.00                       NA            0.00
## 2            0.50                       NA            0.00
## 3            0.33                        1            0.33
## 4            0.33                       NA            0.00
## 5            0.33                        1            0.33
## 6            0.00                        2            1.00
## 7            0.00                       NA            0.00
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                      NA               0.00                   2        1
## 2                       1               0.50                   3        1
## 3                       2               0.67                   2        1
## 4                       1               0.33                   1        1
## 5                       2               0.67                   3        1
## 6                       2               1.00                   2        1
## 7                      NA               0.00                  NA        1
##   POP preg lact prime past unflanged included endomiss
## 1   1    0    0     1    0         0        1        0
## 2   1    0    0     1    0         0        1        0
## 3   1    0    0     1    0         0        1        0
## 4   1    0    0     1    0         0        1        0
## 5   1    0    0     1    0         0        1        0
## 6   1    0    0     0    1         0        1        0
## 7   1    0    0     1    0         0        1        0

Next I created 6 more variables which will serve as each entry of the replicated bar plot. The 3 female ovulatory statuses stay the same, though they are divided bewtween those who mated with prime males and those who mated with non-prime males (either unflanged or past-prime). For each variable I also counted the number of occurences of the type of mating by counting the number of rows.

nonPOP_nonprime <- filter(nonPOP, prime == "0")
nonPOP_nonprime
##    Date day year    year2 DateSPSS      Name     Name2 Record.
## 1 33878 275   92 92.75291  10/1/92   Marissa   Marissa      20
## 2 34061  93   93 93.25394   4/3/93   Marissa   Marissa      22
## 3 34340   7   94 94.01780   1/7/94 Elizabeth Elizabeth      31
## 4 34343  10   94 94.02601  1/10/94    Zarina    Zarina      35
## 5 34344  11   94 94.02875  1/11/94    Zarina    Zarina      41
## 6 36210  50   99 99.13758  2/19/99   Kristen   Kristen      78
##   TypeofInteraction FemaleAgeclass FemaleMotherClass OffspringClass
## 1          Mating 1   Adult Female            Mother     Over 4 yrs
## 2          Mating 1   Adult Female            Mother     Over 4 yrs
## 3          Mating 1   Adult Female            Mother     Inf no juv
## 4          Mating 1   Adult Female            Mother     Over 4 yrs
## 5          Mating 1   Adult Female            Mother     Over 4 yrs
## 6          Mating 1   Adult Female            Mother    Inf ind juv
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                         L7                                           
## 2                         L8                                           
## 3                         L4                                           
## 4                                                                      
## 5                                                                      
## 6                         L1                                           
##   ReproductiveStatus       Endo2   Endo3   Endo4   Endo5     Endo6   Endo7
## 1            Cycling     non-POP non-POP non-POP non-POP   non-POP non-POP
## 2            Cycling     non-POP non-POP non-POP non-POP   non-POP non-POP
## 3            Cycling     non-POP Cycling     POP     POP  Near-POP     POP
## 4            Cycling     non-POP non-POP non-POP non-POP   non-POP non-POP
## 5            Cycling     non-POP non-POP non-POP non-POP   non-POP non-POP
## 6          Lactating non-cycling non-POP non-POP non-POP Lactating No Data
##     Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1 non-POP               Non-Preg      NA      NA         NA
## 2 non-POP               Non-Preg      NA      NA         NA
## 3 non-POP               Non-Preg      NA      NA         NA
## 4 non-POP               Non-Preg      NA      NA         NA
## 5 non-POP               Non-Preg      NA      NA         NA
## 6 No Data               Non-Preg      NA      NA         NA
##                                                                 EndorineComment
## 1                                    ovulation occurs 15-17 Oct -- see attached
## 2                                                              mid-luteal phase
## 3 High P 6 Jan-16 Jan, no data when E peak occurred, looks just after ovulation
## 4                                        Ovulation occurs between 1/16 and 1/22
## 5                                        Ovulation occurs between 1/16 and 1/22
## 6                                                                              
##   SocialInteraction InteractionwithMale Mating NearMating Consortship
## 1                 Y                   Y      Y          N           N
## 2                 Y                   Y      Y          N           N
## 3                 Y                   Y      Y          N           Y
## 4                 Y                   Y      Y          N           Y
## 5                 Y                   Y      Y          N           Y
## 6                 Y                   Y      Y          N           N
##   ObservationMinutes             FollowType FollowTypeII Lengthofmating
## 1                281 D  found then full day            D       0.006250
## 2                700                F  full            F       0.006053
## 3                785       L  late full day            F       0.001389
## 4                815                F  full            F       0.001273
## 5                820                F  full            F       0.003299
## 6                253 D  found then full day                    0.002894
##   PelvicThrusts       Male MaletypeI MaleTypeII MaleTypeIII
## 1            NA UML02Oct96 Unflanged  Unflanged   Non-Prime
## 2            NA UML03Apr97 Unflanged  Unflanged   Non-Prime
## 3            10     Gagung Unflanged  Unflanged   Non-Prime
## 4            NA       Toby Unflanged  Unflanged   Non-Prime
## 5            98       Toby Unflanged  Unflanged   Non-Prime
## 6            NA      Roman   Flanged Past Prime   Non-Prime
##   MatingTypeExcel MatingTypePercent MatingTypePercentII MatingTypeII
## 1          Forced            Forced              Forced       Forced
## 2          Forced            Forced              Forced       Forced
## 3     Cooperative       Cooperative         Cooperative     Unforced
## 4     Cooperative       Cooperative         Cooperative     Unforced
## 5          Forced            Forced              Forced       Forced
## 6          Forced            Forced              Forced     Unforced
##   MatingTypeIII Matingtypequestionable
## 1      Resisted                     No
## 2      Resisted                     No
## 3    Unresisted                     No
## 4    Unresisted                     No
## 5      Resisted                     No
## 6    Unresisted                    Yes
##   TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                 2
## 2                                                 4
## 3                                                 3
## 4                                                 1
## 5                                                 2
## 6                                                 5
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                          NA                          NA
## 2                          NA                           1
## 3                           1                          NA
## 4                           1                          NA
## 5                          NA                          NA
## 6                          NA                           1
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                         NA                  0.00                  NA
## 2                          1                  0.25                  NA
## 3                          1                  0.33                   1
## 4                          1                  1.00                  NA
## 5                         NA                  0.00                  NA
## 6                          1                  0.20                  NA
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                  0.00                                     NA
## 2                  0.00                                      1
## 3                  0.33                                      2
## 4                  0.00                                      1
## 5                  0.00                                     NA
## 6                  0.00                                      1
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                              0.00                       NA
## 2                              0.25                        1
## 3                              0.67                        1
## 4                              1.00                       NA
## 5                              0.00                        1
## 6                              0.20                        4
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1            0.00                        2             1.0
## 2            0.25                        2             0.5
## 3            0.33                       NA             0.0
## 4            0.00                       NA             0.0
## 5            0.50                        1             0.5
## 6            0.80                       NA             0.0
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                       2               1.00                   1        1
## 2                       3               0.75                  NA        1
## 3                       1               0.33                   3        1
## 4                      NA               0.00                  NA        1
## 5                       2               1.00                   1        1
## 6                       4               0.80                   1        1
##   POP preg lact prime past unflanged included endomiss
## 1   0    0    0     0    0         1        1        0
## 2   0    0    0     0    0         1        1        0
## 3   0    0    0     0    0         1        1        0
## 4   0    0    0     0    0         1        1        0
## 5   0    0    0     0    0         1        1        0
## 6   0    0    1     0    1         0        1        0
totalmatings1 <- length(attributes(nonPOP_nonprime)$row.names)
nonPOP_prime <- filter(nonPOP, prime == "1")
nonPOP_prime
##  [1] Date                                             
##  [2] day                                              
##  [3] year                                             
##  [4] year2                                            
##  [5] DateSPSS                                         
##  [6] Name                                             
##  [7] Name2                                            
##  [8] Record.                                          
##  [9] TypeofInteraction                                
## [10] FemaleAgeclass                                   
## [11] FemaleMotherClass                                
## [12] OffspringClass                                   
## [13] ObservedReproductiveStatus                       
## [14] EndocrineStatusHormones                          
## [15] CyclePhaseHormones                               
## [16] ReproductiveStatus                               
## [17] Endo2                                            
## [18] Endo3                                            
## [19] Endo4                                            
## [20] Endo5                                            
## [21] Endo6                                            
## [22] Endo7                                            
## [23] Endo8                                            
## [24] Pregnantvs.nonpregnant                           
## [25] E1CmgCr                                          
## [26] PDGmgCr                                          
## [27] CommentMET                                       
## [28] EndorineComment                                  
## [29] SocialInteraction                                
## [30] InteractionwithMale                              
## [31] Mating                                           
## [32] NearMating                                       
## [33] Consortship                                      
## [34] ObservationMinutes                               
## [35] FollowType                                       
## [36] FollowTypeII                                     
## [37] Lengthofmating                                   
## [38] PelvicThrusts                                    
## [39] Male                                             
## [40] MaletypeI                                        
## [41] MaleTypeII                                       
## [42] MaleTypeIII                                      
## [43] MatingTypeExcel                                  
## [44] MatingTypePercent                                
## [45] MatingTypePercentII                              
## [46] MatingTypeII                                     
## [47] MatingTypeIII                                    
## [48] Matingtypequestionable                           
## [49] TotalnonresistantProceptiveandResistanceBehaviors
## [50] NonResistantBeforeBehaviors                      
## [51] NonResistantDuringBehaviors                      
## [52] Totalnonresistantbehaviors                       
## [53] NonresistantBehaviors                            
## [54] ProceptiveBehaviors                              
## [55] ProceptiveBehaviors_A                            
## [56] TotalunresistedandProcepetivebehaviors           
## [57] unresistedandProcepetivebehaviors                
## [58] ResistantBeforeBehaviors                         
## [59] BeforeBehaviors                                  
## [60] ResistantDuringBehaviors                         
## [61] DuringBehaviors                                  
## [62] TotalResistantBehaviors                          
## [63] ResistantBehaviors                               
## [64] AttractionBehaviors                              
## [65] Mating01                                         
## [66] POP                                              
## [67] preg                                             
## [68] lact                                             
## [69] prime                                            
## [70] past                                             
## [71] unflanged                                        
## [72] included                                         
## [73] endomiss                                         
## <0 rows> (or 0-length row.names)
totalmatings2 <- length(attributes(nonPOP_prime)$row.names)
pregnant_nonprime <- filter(pregnant, prime == "0")
pregnant_nonprime
##    Date day year    year2 DateSPSS     Name   Name2 Record.
## 1 33193 321   90 90.87748 11/17/90  Kristen Kristen       7
## 2 33194 322   90 90.88022 11/18/90  Kristen Kristen       8
## 3 33194 322   90 90.88022 11/18/90  Kristen Kristen       9
## 4 33248  10   91 91.02806  1/10/91 Female A Afemale      10
## 5 33257  19   91 91.05270  1/19/91     Beth    Beth      11
##   TypeofInteraction FemaleAgeclass FemaleMotherClass OffspringClass
## 1          Mating 1   Adult Female            Mother     Over 4 yrs
## 2          Mating 1   Adult Female            Mother     Over 4 yrs
## 3          Mating 2   Adult Female            Mother     Over 4 yrs
## 4          Mating 1   Adult Female        Non-mother      No infant
## 5          Mating 1   Adult Female        Non-mother      No infant
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                   Pregnant                                           
## 2                   Pregnant                                           
## 3                   Pregnant                                           
## 4                   Pregnant                                           
## 5                   Pregnant                                           
##   ReproductiveStatus       Endo2    Endo3    Endo4    Endo5    Endo6
## 1           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 2           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 3           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 4           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 5           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
##     Endo7    Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1 non-POP Pregnant               Pregnant      NA      NA         NA
## 2 non-POP Pregnant               Pregnant      NA      NA         NA
## 3 non-POP Pregnant               Pregnant      NA      NA         NA
## 4 non-POP Pregnant               Pregnant      NA      NA         NA
## 5 non-POP Pregnant               Pregnant      NA      NA         NA
##                                                                                EndorineComment
## 1 Pregnant as of 22 Nov 94, no sample this date: could be pregnant already or conceptive cycle
## 2 Pregnant as of 22 Nov 94, no sample this date: could be pregnant already or conceptive cycle
## 3 Pregnant as of 22 Nov 94, no sample this date: could be pregnant already or conceptive cycle
## 4                                                    Pregnant based on CK\032s analysis of E1C
## 5                                                                                   High E & P
##   SocialInteraction InteractionwithMale Mating NearMating Consortship
## 1                 Y                   Y      Y          N           Y
## 2                 Y                   Y      Y          N           Y
## 3                 Y                   Y      Y          N           Y
## 4                 Y                   Y      Y          N           Y
## 5                 Y                   Y      Y                      Y
##   ObservationMinutes FollowType FollowTypeII Lengthofmating PelvicThrusts
## 1                 NA N  No data                    0.009028            NA
## 2                424    H  lost            M       0.004861            NA
## 3                424    H  lost            M       0.021528            NA
## 4                617    H  lost            H       0.004861            NA
## 5                743    F  full            F       0.015972            NA
##         Male MaletypeI MaleTypeII MaleTypeIII MatingTypeExcel
## 1     Male V Unflanged  Unflanged   Non-Prime     Cooperative
## 2     Male V Unflanged  Unflanged   Non-Prime     Cooperative
## 3     Male V Unflanged  Unflanged   Non-Prime     Cooperative
## 4 Subadult T Unflanged  Unflanged   Non-Prime     Cooperative
## 5       Phil Unflanged  Unflanged   Non-Prime     Cooperative
##   MatingTypePercent MatingTypePercentII MatingTypeII MatingTypeIII
## 1       Cooperative         Cooperative     Unforced    Proceptive
## 2           No Data         Cooperative     Unforced    Unresisted
## 3       Cooperative         Cooperative     Unforced    Proceptive
## 4       Cooperative         Cooperative     Unforced    Unresisted
## 5       Cooperative         Cooperative     Unforced    Proceptive
##   Matingtypequestionable TotalnonresistantProceptiveandResistanceBehaviors
## 1                     No                                                 2
## 2                     No                                                NA
## 3                     No                                                 2
## 4                     No                                                 1
## 5                     No                                                 4
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                           1                          NA
## 2                          NA                          NA
## 3                           1                          NA
## 4                           1                          NA
## 5                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                          1                   0.5                   1
## 2                         NA                    NA                  NA
## 3                          1                   0.5                   1
## 4                          1                   1.0                  NA
## 5                         NA                   0.0                   4
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                   0.5                                      2
## 2                    NA                                     NA
## 3                   0.5                                      2
## 4                   0.0                                      1
## 5                   1.0                                      4
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                                 1                       NA
## 2                                NA                       NA
## 3                                 1                       NA
## 4                                 1                       NA
## 5                                 1                       NA
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1               0                       NA               0
## 2              NA                       NA              NA
## 3               0                       NA               0
## 4               0                       NA               0
## 5               0                       NA               0
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                      NA                  0                   1        1
## 2                      NA                 NA                  NA        1
## 3                      NA                  0                  NA        1
## 4                      NA                  0                   1        1
## 5                      NA                  0                  NA        1
##   POP preg lact prime past unflanged included endomiss
## 1   0    1    0     0    0         1        1        0
## 2   0    1    0     0    0         1        1        0
## 3   0    1    0     0    0         1        1        0
## 4   0    1    0     0    0         1        1        0
## 5   0    1    0     0    0         1        1        0
totalmatings3 <- length(attributes(pregnant_nonprime)$row.names)
pregnant_prime <- filter(pregnant, prime == "1")
pregnant_prime
##    Date day year    year2 DateSPSS  Name Name2 Record. TypeofInteraction
## 1 35764 335   97 97.91650  12/1/97 Kayla Kayla      73          Mating 1
## 2 35765 336   97 97.91923  12/2/97 Kayla Kayla      75          Mating 1
## 3 35766 337   97 97.92197  12/3/97 Kayla Kayla      76          Mating 1
##   FemaleAgeclass FemaleMotherClass OffspringClass
## 1   Adult Female        Non-mother      No infant
## 2   Adult Female        Non-mother      No infant
## 3   Adult Female        Non-mother      No infant
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                   Pregnant                                           
## 2                   Pregnant                                           
## 3                   Pregnant                 cycling           Not sure
##   ReproductiveStatus       Endo2    Endo3    Endo4    Endo5    Endo6
## 1           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 2           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 3           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
##     Endo7    Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1 non-POP Pregnant               Pregnant      NA      NA         NA
## 2 non-POP Pregnant               Pregnant      NA      NA         NA
## 3 non-POP Pregnant               Pregnant      NA    2275         NA
##   EndorineComment SocialInteraction InteractionwithMale Mating NearMating
## 1                                 Y                   Y      Y          Y
## 2                                 Y                   Y      Y          N
## 3                                 Y                   Y      Y          N
##   Consortship ObservationMinutes       FollowType FollowTypeII
## 1           Y                285 L  late full day             
## 2           Y                880          F  full            F
## 3           Y                815          F  full            F
##   Lengthofmating PelvicThrusts    Male MaletypeI MaleTypeII MaleTypeIII
## 1       0.006944           374 Wendell   Flanged Prime Male       Prime
## 2       0.008333           384 Wendell   Flanged Prime Male       Prime
## 3       0.002083            NA Wendell   Flanged Prime Male       Prime
##   MatingTypeExcel MatingTypePercent MatingTypePercentII MatingTypeII
## 1     Cooperative       Cooperative         Cooperative     Unforced
## 2     Cooperative       Cooperative         Cooperative     Unforced
## 3                       Cooperative         Cooperative     Unforced
##   MatingTypeIII Matingtypequestionable
## 1    Proceptive                     No
## 2    Proceptive                     No
## 3    Proceptive                     No
##   TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                 4
## 2                                                 7
## 3                                                 5
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                          NA                          NA
## 2                          NA                          NA
## 3                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                         NA                     0                   4
## 2                         NA                     0                   7
## 3                         NA                     0                   5
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                     1                                      4
## 2                     1                                      7
## 3                     1                                      5
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                                 1                       NA
## 2                                 1                       NA
## 3                                 1                       NA
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1               0                       NA               0
## 2               0                       NA               0
## 3               0                       NA               0
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                      NA                  0                   2        1
## 2                      NA                  0                   5        1
## 3                      NA                  0                  NA        1
##   POP preg lact prime past unflanged included endomiss
## 1   0    1    0     1    0         0        1        0
## 2   0    1    0     1    0         0        1        0
## 3   0    1    0     1    0         0        1        0
totalmatings4 <- length(attributes(pregnant_prime)$row.names)
POP_nonprime <- filter(POP, prime == "0")
POP_nonprime
##    Date day year    year2 DateSPSS   Name  Name2 Record. TypeofInteraction
## 1 34347  14   94 94.03696  1/14/94 Zarina Zarina      42          Mating 1
##   FemaleAgeclass FemaleMotherClass OffspringClass
## 1   Adult Female            Mother     Over 4 yrs
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                                                                      
##   ReproductiveStatus Endo2   Endo3 Endo4 Endo5 Endo6 Endo7 Endo8
## 1            Cycling   POP Cycling   POP   POP   POP   POP   POP
##   Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1               Non-Preg      NA      NA         NA
##                          EndorineComment SocialInteraction
## 1 Ovulation occurs between 1/16 and 1/22                 Y
##   InteractionwithMale Mating NearMating Consortship ObservationMinutes
## 1                   Y      Y          N           Y                795
##   FollowType FollowTypeII Lengthofmating PelvicThrusts  Male MaletypeI
## 1    F  full            F       0.004086           261 Roman   Flanged
##   MaleTypeII MaleTypeIII MatingTypeExcel MatingTypePercent
## 1 Past Prime   Non-Prime          Forced            Forced
##   MatingTypePercentII MatingTypeII MatingTypeIII Matingtypequestionable
## 1              Forced       Forced      Resisted                     No
##   TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                 2
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                         NA                     0                  NA
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                     0                                     NA
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                                 0                       NA
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1               0                        2               1
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                       2                  1                   2        1
##   POP preg lact prime past unflanged included endomiss
## 1   1    0    0     0    1         0        1        0
totalmatings5 <- length(attributes(POP_nonprime)$row.names)
POP_prime <- filter(POP, prime == "1")
POP_prime
##    Date day year    year2 DateSPSS    Name   Name2 Record.
## 1 34318 350   93 93.95756 12/16/93 Marissa Marissa      26
## 2 34318 350   93 93.95756 12/16/93 Marissa Marissa      27
## 3 34340   7   94 94.01780   1/7/94 Marissa Marissa      30
## 4 34341   8   94 94.02053   1/8/94 Marissa Marissa      32
## 5 34343  10   94 94.02601  1/10/94 Marissa Marissa      39
## 6 34349  16   94 94.04244  1/16/94  Zarina  Zarina      45
##   TypeofInteraction FemaleAgeclass FemaleMotherClass OffspringClass
## 1          Mating 1   Adult Female            Mother     Over 4 yrs
## 2          Mating 2   Adult Female            Mother     Over 4 yrs
## 3          Mating 1   Adult Female            Mother     Over 4 yrs
## 4          Mating 1   Adult Female            Mother     Over 4 yrs
## 5          Mating 1   Adult Female            Mother     Over 4 yrs
## 6          Mating 1   Adult Female            Mother     Over 4 yrs
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                         L8                 cycling                pop
## 2                         L8                 cycling                pop
## 3                                                                      
## 4                                                                      
## 5                                            cycling           near-pop
## 6                                                                      
##   ReproductiveStatus    Endo2   Endo3 Endo4   Endo5    Endo6   Endo7
## 1            Cycling      POP Cycling   POP     POP      POP     POP
## 2            Cycling      POP Cycling   POP     POP      POP     POP
## 3            Cycling Near-POP Cycling   POP non-POP Near-POP non-POP
## 4            Cycling Near-POP Cycling   POP non-POP Near-POP non-POP
## 5            Cycling Near-POP Cycling   POP non-POP Near-POP non-POP
## 6            Cycling      POP Cycling   POP     POP      POP     POP
##     Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1     POP               Non-Preg   46754    1249         NA
## 2     POP               Non-Preg   46754    1249         NA
## 3 non-POP               Non-Preg      NA      NA         NA
## 4 non-POP               Non-Preg      NA      NA         NA
## 5 non-POP               Non-Preg   65153     891         NA
## 6     POP               Non-Preg      NA      NA         NA
##                                        EndorineComment SocialInteraction
## 1       ovulation occurs approx 15-16 Dec see attached                 Y
## 2       ovulation occurs approx 15-16 Dec see attached                 Y
## 3 ovulation should occur approx 15-17 Jan see attached                 Y
## 4 ovulation should occur approx 15-17 Jan see attached                 Y
## 5 ovulation should occur approx 15-17 Jan see attached                 Y
## 6               Ovulation occurs between 1/16 and 1/22                 Y
##   InteractionwithMale Mating NearMating Consortship ObservationMinutes
## 1                   Y      Y          Y           Y                667
## 2                   Y      Y          Y           Y                667
## 3                   Y      Y          Y           N                806
## 4                   Y      Y          Y           Y                792
## 5                   Y      Y          Y           Y                770
## 6                   Y      Y          Y           Y                648
##   FollowType FollowTypeII Lengthofmating PelvicThrusts       Male
## 1    F  full            F       0.003785            NA Jari Manis
## 2    F  full            F       0.004074            NA Jari Manis
## 3    F  full            F       0.002743            NA Jari Manis
## 4    F  full            F       0.010266            NA Jari Manis
## 5    F  full            F       0.001910           224 Jari Manis
## 6    H  lost                    0.009028           113 Jari Manis
##   MaletypeI MaleTypeII MaleTypeIII MatingTypeExcel MatingTypePercent
## 1   Flanged Prime Male       Prime     Cooperative       Cooperative
## 2   Flanged Prime Male       Prime     Cooperative       Cooperative
## 3   Flanged Prime Male       Prime          Forced            Forced
## 4   Flanged Prime Male       Prime          Forced       Cooperative
## 5   Flanged Prime Male       Prime          Forced            Forced
## 6   Flanged Prime Male       Prime     Cooperative       Cooperative
##   MatingTypePercentII MatingTypeII MatingTypeIII Matingtypequestionable
## 1         Cooperative     Unforced    Unresisted                     No
## 2         Cooperative     Unforced    Unresisted                     No
## 3              Forced       Forced      Resisted                     No
## 4         Cooperative     Unforced    Unresisted                    Yes
## 5              Forced       Forced      Resisted                     No
## 6         Cooperative     Unforced    Proceptive                     No
##   TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                 1
## 2                                                 2
## 3                                                 3
## 4                                                 3
## 5                                                 3
## 6                                                 6
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                           1                          NA
## 2                          NA                           1
## 3                          NA                           1
## 4                           1                           1
## 5                          NA                           1
## 6                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                          1                  1.00                  NA
## 2                          1                  0.50                  NA
## 3                          1                  0.33                  NA
## 4                          2                  0.67                  NA
## 5                          1                  0.33                  NA
## 6                         NA                  0.00                   6
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                     0                                      1
## 2                     0                                      1
## 3                     0                                      1
## 4                     0                                      2
## 5                     0                                      1
## 6                     1                                      6
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                              1.00                       NA
## 2                              0.50                        1
## 3                              0.33                        1
## 4                              0.67                        1
## 5                              0.33                        1
## 6                              1.00                       NA
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1            0.00                       NA            0.00
## 2            0.50                       NA            0.00
## 3            0.33                        1            0.33
## 4            0.33                       NA            0.00
## 5            0.33                        1            0.33
## 6            0.00                       NA            0.00
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                      NA               0.00                   2        1
## 2                       1               0.50                   3        1
## 3                       2               0.67                   2        1
## 4                       1               0.33                   1        1
## 5                       2               0.67                   3        1
## 6                      NA               0.00                  NA        1
##   POP preg lact prime past unflanged included endomiss
## 1   1    0    0     1    0         0        1        0
## 2   1    0    0     1    0         0        1        0
## 3   1    0    0     1    0         0        1        0
## 4   1    0    0     1    0         0        1        0
## 5   1    0    0     1    0         0        1        0
## 6   1    0    0     1    0         0        1        0
totalmatings6 <- length(attributes(POP_prime)$row.names)

I then created a vector of each of the values of occurences.

v <- c(totalmatings1, totalmatings2, totalmatings3, totalmatings4, totalmatings5, totalmatings6)

barplot(v, main = "Figure 1", xlab = "female endocrine status", ylab = "mating events observed", names.arg = c("non-periovulatory","non-periovulatory","pregnant","pregnant", "periovulatory", "periovulatory"), col = "black", density = c(100, 0, 100, 0, 100, 0), space = c(1, 0, 1, 0, 1, 0))

This is what the original figure from the paper looked like:

They are the same! As stated in the paper, this figure shows that non-periovulatory females mated most frequently with non-prime males, while periovulatory females mated most frequently with prime males.

It is possible that there is a more concise way to replicate this figure, though this way seemed the most logical to me, given the format of the data.

Figure 2 (Descriptive)

The second figure in the paper shows the distribution of female encounters with males, with respect to male type and female ovulatory status. I planned to use a similar method to create this figure as I did for the first one (the dependent variable is now ‘encounters observed’), though I ran into a lot of problems.

I recieved this dataset from the professor who is first author on this paper. She did not have the original files, so she reached out to the author who ran all the statistics for the paper. He emailed her zipped folders of all of the old versions of the dataset that he had. She then forwarded these folders to me, which contained hundreds of different documents which spanned the course of nearly 3 years. Unfortunately, all the observation data was spread out between different files which led to confusion. Additionally, the same writing conventions were not used throughout all the daat. For example, some variables were recorded as full words like “Prime” and “Nonprime” , while others were recorded as binary numbers “0” and “1”.

Attempt 1

To begin the second replication, I first converted another SPSS file into csv format and loaded it in to R. This file contains all 2460 orangutan follows.

# getting the data into R
library(curl)
f2 <- curl("https://raw.githubusercontent.com/natalierobinson96/data-reanalysis-assignment/master/interactions.csv")
d2 <- read.csv(f2, header = TRUE, sep = ",")
head(d2)
##    Date day year    year2   DateSPSS    Name   Name2 Record.
## 1 34397  64   94 94.17385 03/05/1994 Marissa Marissa     959
## 2 34398  65   94 94.17659 03/06/1994 Marissa Marissa     961
## 3 34504 171   94 94.46680 06/20/1994    Abby    Abby    1107
## 4 34505 172   94 94.46954 06/21/1994    Abby    Abby    1110
## 5 34506 173   94 94.47228 06/22/1994    Abby    Abby    1113
## 6 34507 174   94 94.47502 06/23/1994    Abby    Abby    1116
##   TypeofInteraction FemaleAgeclass FemaleMotherClass OffspringClass
## 1                     Adult Female            Mother     Over 4 yrs
## 2                     Adult Female            Mother     Over 4 yrs
## 3                     Adult Female            Mother     Over 4 yrs
## 4                     Adult Female            Mother     Over 4 yrs
## 5                     Adult Female            Mother     Over 4 yrs
## 6                     Adult Female            Mother     Over 4 yrs
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                   Pregnant                                           
## 2                   Pregnant                                           
## 3                    Unknown                                           
## 4                    Unknown                 cycling            non-pop
## 5                    Unknown                 cycling            non-pop
## 6                    Unknown                 cycling            non-pop
##       ReproductiveStatus       Endo2    Endo3    Endo4    Endo5    Endo6
## 1 Conception or pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 2 Conception or pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 3                Cycling     Cycling  Cycling  Cycling  Cycling  No Data
## 4                Cycling     non-POP  non-POP  non-POP  non-POP  non-POP
## 5                Cycling     non-POP  non-POP  non-POP  non-POP  non-POP
## 6                Cycling     non-POP  non-POP  non-POP  non-POP  non-POP
##     Endo7    Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1 non-POP Pregnant               Pregnant      NA      NA           
## 2 non-POP Pregnant               Pregnant      NA      NA           
## 3 No Data  No Data               Non-Preg      NA      NA           
## 4 non-POP  non-POP               Non-Preg    4695    1776           
## 5 non-POP  non-POP               Non-Preg    8165    1768           
## 6 non-POP  non-POP               Non-Preg    6824    1938           
##   EndorineComment SocialInteraction InteractionwithMale Mating NearMating
## 1                                 Y                   N      N          N
## 2                                 N                   N      N          N
## 3                                 N                   N      N          N
## 4                                 Y                   N      N          N
## 5                                 N                   N      N          N
## 6                                 N                   N      N          N
##   Consortship ObservationMinutes             FollowType FollowTypeII
## 1           N                555 D  found then full day             
## 2           N                300                H  lost             
## 3           N                392 D  found then full day             
## 4           N                799                F  full            F
## 5           N                692                F  full            F
## 6           N                780                F  full            F
##   Lengthofmating PelvicThrusts Male MaletypeI MaleTypeII MaleTypeIII
## 1             NA            NA                                      
## 2             NA            NA                                      
## 3             NA            NA                                      
## 4             NA            NA                                      
## 5             NA            NA                                      
## 6             NA            NA                                      
##   MatingTypeExcel MatingTypePercent MatingTypePercentII MatingTypeII
## 1                                                                   
## 2                                                                   
## 3                                                                   
## 4                                                                   
## 5                                                                   
## 6                                                                   
##   MatingTypeIII Matingtypequestionable
## 1                                     
## 2                                     
## 3                                     
## 4                                     
## 5                                     
## 6                                     
##   TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                NA
## 2                                                NA
## 3                                                NA
## 4                                                NA
## 5                                                NA
## 6                                                NA
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                          NA                          NA
## 2                          NA                          NA
## 3                          NA                          NA
## 4                          NA                          NA
## 5                          NA                          NA
## 6                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                         NA                    NA                  NA
## 2                         NA                    NA                  NA
## 3                         NA                    NA                  NA
## 4                         NA                    NA                  NA
## 5                         NA                    NA                  NA
## 6                         NA                    NA                  NA
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                    NA                                     NA
## 2                    NA                                     NA
## 3                    NA                                     NA
## 4                    NA                                     NA
## 5                    NA                                     NA
## 6                    NA                                     NA
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                                NA                       NA
## 2                                NA                       NA
## 3                                NA                       NA
## 4                                NA                       NA
## 5                                NA                       NA
## 6                                NA                       NA
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1              NA                       NA              NA
## 2              NA                       NA              NA
## 3              NA                       NA              NA
## 4              NA                       NA              NA
## 5              NA                       NA              NA
## 6              NA                       NA              NA
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                      NA                 NA                  NA        0
## 2                      NA                 NA                  NA        0
## 3                      NA                 NA                  NA        0
## 4                      NA                 NA                  NA        0
## 5                      NA                 NA                  NA        0
## 6                      NA                 NA                  NA        0
##   POP preg lact prime past unflanged included endomiss
## 1   0    0    0    NA   NA        NA        0        0
## 2   0    0    0    NA   NA        NA        0        0
## 3   0    0    0    NA   NA        NA        0        1
## 4   0    0    0    NA   NA        NA        0        0
## 5   0    0    0    NA   NA        NA        0        0
## 6   0    0    0    NA   NA        NA        0        0

Next I created a new dataframe which only includes the observation entries (in which a male and female interacted with each other) which were included in the final analysis (in which both male and female reproductive status were known):

d2 <- filter(d2, InteractionwithMale == "Y")
d2 <- filter(d2, included == "1")
head(d2)
##    Date day year    year2   DateSPSS        Name       Name2 Record.
## 1 34343  10   94 94.02601 01/10/1994 AF10Jan98\v AF10Jan98\v      36
## 2 34343  10   94 94.02601 01/10/1994 AF10Jan98\v AF10Jan98\v      37
## 3 33168 296   90 90.80903 10/23/1990    Betina A      Betina     100
## 4 34338   5   94 94.01232 01/05/1994    Betina Q      Betina     867
## 5 34340   7   94 94.01780 01/07/1994    Betina P      Betina     875
## 6 34341   8   94 94.02053 01/08/1994    Betina P      Betina     877
##   TypeofInteraction FemaleAgeclass FemaleMotherClass OffspringClass
## 1          Mating 1   Adult Female        Non-mother      No infant
## 2          Mating 2   Adult Female        Non-mother      No infant
## 3                     Adult Female        Non-mother      No infant
## 4       Consortship   Adult Female            Mother     Over 4 yrs
## 5       Consortship   Adult Female            Mother     Over 4 yrs
## 6                     Adult Female            Mother     Over 4 yrs
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                                                                      
## 2                                                                      
## 3                    Cycling                                           
## 4                                                                      
## 5                                            cycling           Not sure
## 6                                                                      
##   ReproductiveStatus   Endo2   Endo3   Endo4   Endo5   Endo6   Endo7
## 1            Cycling Cycling Cycling Cycling Cycling No Data No Data
## 2            Cycling Cycling Cycling Cycling Cycling No Data No Data
## 3            Cycling Cycling Cycling Cycling Cycling No Data No Data
## 4            Cycling Cycling Cycling Cycling Cycling No Data No Data
## 5            Cycling Cycling Cycling Cycling Cycling No Data No Data
## 6            Cycling Cycling Cycling Cycling Cycling No Data No Data
##     Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1 No Data               Non-Preg      NA      NA           
## 2 No Data               Non-Preg      NA      NA           
## 3 No Data               Non-Preg      NA      NA           
## 4 No Data               Non-Preg      NA      NA           
## 5 No Data               Non-Preg   19850     647           
## 6 No Data               Non-Preg      NA      NA           
##   EndorineComment SocialInteraction InteractionwithMale Mating NearMating
## 1                                 Y                   Y      Y           
## 2                                 Y                   Y      Y           
## 3                                 Y                   Y                  
## 4                                 Y                   Y      N          N
## 5                                 Y                   Y      N          N
## 6                                 Y                   Y      N          N
##   Consortship ObservationMinutes             FollowType FollowTypeII
## 1                             NA             N  No data             
## 2                             NA             N  No data             
## 3                            285 D  found then full day            D
## 4           Y                465       T  late and lost             
## 5           Y                815                F  full            F
## 6           N                338       T  late and lost             
##   Lengthofmating PelvicThrusts           Male MaletypeI MaleTypeII
## 1       0.002083            NA     Jari Manis   Flanged Prime Male
## 2             NA            NA     Jari Manis   Flanged Prime Male
## 3             NA            NA            Rob Unflanged  Unflanged
## 4             NA            NA          Roman   Flanged Past Prime
## 5       0.379167            NA Unflanged Male Unflanged  Unflanged
## 6             NA            NA         Gagung Unflanged  Unflanged
##   MaleTypeIII MatingTypeExcel MatingTypePercent MatingTypePercentII
## 1       Prime          Forced            Forced              Forced
## 2       Prime     Cooperative       Cooperative         Cooperative
## 3   Non-Prime                                                      
## 4   Non-Prime                                                      
## 5   Non-Prime                                                      
## 6   Non-Prime                                                      
##   MatingTypeII MatingTypeIII Matingtypequestionable
## 1       Forced      Resisted                     No
## 2     Unforced    Unresisted                     No
## 3                                                  
## 4                                                  
## 5                                                  
## 6                                                  
##   TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                 3
## 2                                                 2
## 3                                                NA
## 4                                                NA
## 5                                                NA
## 6                                                NA
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                          NA                          NA
## 2                           1                           1
## 3                          NA                          NA
## 4                          NA                          NA
## 5                          NA                          NA
## 6                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                         NA                     0                  NA
## 2                          2                     1                  NA
## 3                         NA                    NA                  NA
## 4                         NA                    NA                  NA
## 5                         NA                    NA                  NA
## 6                         NA                    NA                  NA
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                     0                                     NA
## 2                     0                                      2
## 3                    NA                                     NA
## 4                    NA                                     NA
## 5                    NA                                     NA
## 6                    NA                                     NA
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                                 0                        1
## 2                                 1                       NA
## 3                                NA                       NA
## 4                                NA                       NA
## 5                                NA                       NA
## 6                                NA                       NA
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1            0.33                        2            0.67
## 2            0.00                       NA            0.00
## 3              NA                       NA              NA
## 4              NA                       NA              NA
## 5              NA                       NA              NA
## 6              NA                       NA              NA
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                       3                  1                   1        1
## 2                      NA                  0                   1        1
## 3                      NA                 NA                  NA        0
## 4                      NA                 NA                  NA        0
## 5                      NA                 NA                  NA        0
## 6                      NA                 NA                  NA        0
##   POP preg lact prime past unflanged included endomiss
## 1   0    0    0     1    0         0        1        1
## 2   0    0    0     1    0         0        1        1
## 3   0    0    0     0    0         1        1        1
## 4   0    0    0     0    1         0        1        1
## 5   0    0    0     0    0         1        1        1
## 6   0    0    0     0    0         1        1        1

This contains 331 observations, however, the paper states that only 153 encounters were included in the analysis. I continued on anyway.

As before, I created the 3 categories of female endocrine status:

nonPOP <- filter(d2, lact == "1")
head(nonPOP) #matings with females not in periovulatory period; currently cycling
##    Date day year    year2   DateSPSS      Name     Name2 Record.
## 1 33256  18   91 91.04997 01/18/1991    Anissa    Anissa     173
## 2 33953 350   92 92.95825 12/15/1992      Beth      Beth     542
## 3 34007  39   93 93.10609 02/08/1993  Betina J    Betina      21
## 4 33167 295   90 90.80630 10/22/1990     Celia     Celia      99
## 5 34131 163   93 93.44559 06/12/1993 Elizabeth Elizabeth      23
## 6 33234 362   90 90.98973 12/28/1990 Elizabeth Elizabeth     160
##   TypeofInteraction FemaleAgeclass FemaleMotherClass OffspringClass
## 1                     Adult Female            Mother     Inf no juv
## 2                     Adult Female            Mother     Inf no juv
## 3         Attempt 1   Adult Female            Mother     Inf no juv
## 4         Encounter   Adult Female            Mother     Inf no juv
## 5         Attempt 1   Adult Female            Mother     Inf no juv
## 6       Consortship   Adult Female            Mother    Inf ind juv
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                         L1                                           
## 2                         L2                                           
## 3                                                                      
## 4                         L2                                           
## 5                         L4                                           
## 6                         L1               Lactating        non-cycling
##   ReproductiveStatus       Endo2   Endo3   Endo4   Endo5     Endo6   Endo7
## 1          Lactating non-cycling non-POP non-POP non-POP Lactating No Data
## 2          Lactating non-cycling non-POP non-POP non-POP Lactating No Data
## 3          Lactating non-cycling non-POP non-POP non-POP Lactating No Data
## 4          Lactating non-cycling non-POP non-POP non-POP Lactating No Data
## 5          Lactating non-cycling non-POP non-POP non-POP Lactating No Data
## 6          Lactating non-cycling non-POP non-POP non-POP Lactating No Data
##     Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1 No Data               Non-Preg      NA      NA           
## 2 No Data               Non-Preg      NA      NA           
## 3 No Data               Non-Preg      NA      NA           
## 4 No Data               Non-Preg      NA      NA           
## 5 No Data               Non-Preg      NA      NA           
## 6 No Data               Non-Preg   12929     804           
##   EndorineComment SocialInteraction InteractionwithMale Mating NearMating
## 1                                 Y                   Y                  
## 2                                 Y                   Y      N          N
## 3                                 Y                   Y      N          Y
## 4                                 Y                   Y                  
## 5                                 Y                   Y      N          Y
## 6                                 Y                   Y      N          N
##   Consortship ObservationMinutes             FollowType FollowTypeII
## 1                            528 D  found then full day            D
## 2           N                733       L  late full day            F
## 3           Y                194 D  found then full day             
## 4                            333 D  found then full day            M
## 5           Y                590 D  found then full day             
## 6           Y                725                F  full            F
##   Lengthofmating PelvicThrusts           Male MaletypeI MaleTypeII
## 1             NA            NA Unflanged male Unflanged  Unflanged
## 2             NA            NA Unflanged Male Unflanged  Unflanged
## 3             NA            NA Unflanged Male Unflanged  Unflanged
## 4       0.004861            NA Unflanged male Unflanged  Unflanged
## 5             NA            NA          Roman   Flanged Prime Male
## 6             NA            NA Unflanged Male Unflanged  Unflanged
##   MaleTypeIII MatingTypeExcel MatingTypePercent MatingTypePercentII
## 1   Non-Prime                                                      
## 2   Non-Prime                                                      
## 3   Non-Prime                                                      
## 4   Non-Prime                                                      
## 5       Prime                                                      
## 6   Non-Prime                                                      
##   MatingTypeII MatingTypeIII Matingtypequestionable
## 1                                                  
## 2                                                  
## 3                                                  
## 4                                                  
## 5                                                  
## 6                                                  
##   TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                NA
## 2                                                NA
## 3                                                NA
## 4                                                NA
## 5                                                NA
## 6                                                NA
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                          NA                          NA
## 2                          NA                          NA
## 3                          NA                          NA
## 4                          NA                          NA
## 5                          NA                          NA
## 6                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                         NA                    NA                  NA
## 2                         NA                    NA                  NA
## 3                         NA                    NA                  NA
## 4                         NA                    NA                  NA
## 5                         NA                    NA                  NA
## 6                         NA                    NA                  NA
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                    NA                                     NA
## 2                    NA                                     NA
## 3                    NA                                     NA
## 4                    NA                                     NA
## 5                    NA                                     NA
## 6                    NA                                     NA
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                                NA                       NA
## 2                                NA                       NA
## 3                                NA                       NA
## 4                                NA                       NA
## 5                                NA                       NA
## 6                                NA                       NA
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1              NA                       NA              NA
## 2              NA                       NA              NA
## 3              NA                       NA              NA
## 4              NA                       NA              NA
## 5              NA                       NA              NA
## 6              NA                       NA              NA
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                      NA                 NA                  NA        0
## 2                      NA                 NA                  NA        0
## 3                      NA                 NA                  NA        0
## 4                      NA                 NA                  NA        0
## 5                      NA                 NA                  NA        0
## 6                      NA                 NA                  NA        0
##   POP preg lact prime past unflanged included endomiss
## 1   0    0    1     0    0         1        1        0
## 2   0    0    1     0    0         1        1        0
## 3   0    0    1     0    0         1        1        0
## 4   0    0    1     0    0         1        1        0
## 5   0    0    1     1    0         0        1        0
## 6   0    0    1     0    0         1        1        0
pregnant <- filter(d2, preg == "1")
head(pregnant) #matings with pregnant females 
##    Date day year    year2   DateSPSS     Name   Name2 Record.
## 1 33248  10   91 91.02806 01/10/1991 Female A Afemale      10
## 2 33247   9   91 91.02533 01/09/1991 Female A Afemale     169
## 3 33257  19   91 91.05270 01/19/1991     Beth    Beth      11
## 4 33261  23   91 91.06366 01/23/1991     Beth    Beth     182
## 5 33292  54   91 91.14853 02/23/1991     Beth    Beth     221
## 6 33293  55   91 91.15127 02/24/1991     Beth    Beth     223
##   TypeofInteraction FemaleAgeclass FemaleMotherClass OffspringClass
## 1          Mating 1   Adult Female        Non-mother      No infant
## 2       Consortship   Adult Female        Non-mother      No infant
## 3          Mating 1   Adult Female        Non-mother      No infant
## 4       Consortship   Adult Female        Non-mother      No infant
## 5       Consortship   Adult Female        Non-mother      No infant
## 6       Consortship   Adult Female        Non-mother      No infant
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                   Pregnant                                           
## 2                   Pregnant                                           
## 3                   Pregnant                                           
## 4                   Pregnant                                           
## 5                   Pregnant                                           
## 6                   Pregnant                                           
##   ReproductiveStatus       Endo2    Endo3    Endo4    Endo5    Endo6
## 1           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 2           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 3           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 4           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 5           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
## 6           Pregnant non-cycling Pregnant Pregnant Pregnant Pregnant
##     Endo7    Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr CommentMET
## 1 non-POP Pregnant               Pregnant      NA      NA           
## 2 non-POP Pregnant               Pregnant      NA      NA           
## 3 non-POP Pregnant               Pregnant      NA      NA           
## 4 non-POP Pregnant               Pregnant      NA      NA           
## 5 non-POP Pregnant               Pregnant      NA      NA           
## 6 non-POP Pregnant               Pregnant      NA      NA           
##                             EndorineComment SocialInteraction
## 1 Pregnant based on CK\032s analysis of E1C                 Y
## 2                                                           Y
## 3                                High E & P                 Y
## 4                                                           Y
## 5                                                           Y
## 6                                                           Y
##   InteractionwithMale Mating NearMating Consortship ObservationMinutes
## 1                   Y      Y          N           Y                617
## 2                   Y                             Y                 NA
## 3                   Y      Y                      Y                743
## 4                   Y                 Y           Y                538
## 5                   Y      N          N           Y                160
## 6                   Y                             Y                705
##               FollowType FollowTypeII Lengthofmating PelvicThrusts
## 1                H  lost            H       0.004861            NA
## 2             N  No data                          NA            NA
## 3                F  full            F       0.015972            NA
## 4 D  found then full day            D             NA            NA
## 5 D  found then full day            D             NA            NA
## 6       L  late full day            F             NA            NA
##         Male MaletypeI MaleTypeII MaleTypeIII MatingTypeExcel
## 1 Subadult T Unflanged  Unflanged   Non-Prime     Cooperative
## 2 Subadult T Unflanged  Unflanged   Non-Prime                
## 3       Phil Unflanged  Unflanged   Non-Prime     Cooperative
## 4       Phil Unflanged  Unflanged   Non-Prime                
## 5     Male E   Flanged Prime Male       Prime                
## 6     Male E   Flanged Prime Male       Prime                
##   MatingTypePercent MatingTypePercentII MatingTypeII MatingTypeIII
## 1       Cooperative         Cooperative     Unforced    Unresisted
## 2                                                                 
## 3       Cooperative         Cooperative     Unforced    Proceptive
## 4                                                                 
## 5                                                                 
## 6                                                                 
##   Matingtypequestionable TotalnonresistantProceptiveandResistanceBehaviors
## 1                     No                                                 1
## 2                                                                       NA
## 3                     No                                                 4
## 4                                                                       NA
## 5                                                                       NA
## 6                                                                       NA
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                           1                          NA
## 2                          NA                          NA
## 3                          NA                          NA
## 4                          NA                          NA
## 5                          NA                          NA
## 6                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                          1                     1                  NA
## 2                         NA                    NA                  NA
## 3                         NA                     0                   4
## 4                         NA                    NA                  NA
## 5                         NA                    NA                  NA
## 6                         NA                    NA                  NA
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                     0                                      1
## 2                    NA                                     NA
## 3                     1                                      4
## 4                    NA                                     NA
## 5                    NA                                     NA
## 6                    NA                                     NA
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                                 1                       NA
## 2                                NA                       NA
## 3                                 1                       NA
## 4                                NA                       NA
## 5                                NA                       NA
## 6                                NA                       NA
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1               0                       NA               0
## 2              NA                       NA              NA
## 3               0                       NA               0
## 4              NA                       NA              NA
## 5              NA                       NA              NA
## 6              NA                       NA              NA
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                      NA                  0                   1        1
## 2                      NA                 NA                  NA        0
## 3                      NA                  0                  NA        1
## 4                      NA                 NA                  NA        0
## 5                      NA                 NA                  NA        0
## 6                      NA                 NA                  NA        0
##   POP preg lact prime past unflanged included endomiss
## 1   0    1    0     0    0         1        1        0
## 2   0    1    0     0    0         1        1        0
## 3   0    1    0     0    0         1        1        0
## 4   0    1    0     0    0         1        1        0
## 5   0    1    0     1    0         0        1        0
## 6   0    1    0     1    0         0        1        0
POP <- filter(d2, POP == "1")
head(POP) #matings with females in periovulatory period
##    Date day year    year2   DateSPSS    Name   Name2 Record.
## 1 34297 329   93 93.90007 11/25/1993 Kristen Kristen     797
## 2 34299 331   93 93.90554 11/27/1993 Kristen Kristen     806
## 3 33502 264   91 91.72348 09/21/1991 Marissa Marissa      19
## 4 34318 350   93 93.95756 12/16/1993 Marissa Marissa      26
## 5 34318 350   93 93.95756 12/16/1993 Marissa Marissa      27
## 6 34340   7   94 94.01780 01/07/1994 Marissa Marissa      29
##   TypeofInteraction FemaleAgeclass FemaleMotherClass OffspringClass
## 1                     Adult Female            Mother    Inf ind juv
## 2                     Adult Female            Mother    Inf ind juv
## 3       Consortship   Adult Female            Mother     Over 4 yrs
## 4          Mating 1   Adult Female            Mother     Over 4 yrs
## 5          Mating 2   Adult Female            Mother     Over 4 yrs
## 6         Attempt 1   Adult Female            Mother     Over 4 yrs
##   ObservedReproductiveStatus EndocrineStatusHormones CyclePhaseHormones
## 1                         L3                 cycling                pop
## 2                         L3                 cycling                pop
## 3                         L6                 cycling                pop
## 4                         L8                 cycling                pop
## 5                         L8                 cycling                pop
## 6                                                                      
##   ReproductiveStatus    Endo2   Endo3 Endo4   Endo5    Endo6   Endo7
## 1            Cycling      POP Cycling   POP     POP      POP     POP
## 2            Cycling      POP Cycling   POP     POP      POP     POP
## 3            Cycling      POP Cycling   POP     POP      POP     POP
## 4            Cycling      POP Cycling   POP     POP      POP     POP
## 5            Cycling      POP Cycling   POP     POP      POP     POP
## 6            Cycling Near-POP Cycling   POP non-POP Near-POP non-POP
##     Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr
## 1     POP               Non-Preg   30267     609
## 2     POP               Non-Preg    9672     122
## 3     POP               Non-Preg   21223     687
## 4     POP               Non-Preg   46754    1249
## 5     POP               Non-Preg   46754    1249
## 6 non-POP               Non-Preg      NA      NA
##                                                            CommentMET
## 1                                                                    
## 2 following days are def. luteal, but can't tell when E peak occurred
## 3                                                                    
## 4                                                                    
## 5                                                                    
## 6                                                                    
##                                                              EndorineComment
## 1                                                                           
## 2                                                                           
## 3 Called POP because PDG peaks two days later; but not really sure it is POP
## 4                             ovulation occurs approx 15-16 Dec see attached
## 5                             ovulation occurs approx 15-16 Dec see attached
## 6                       ovulation should occur approx 15-17 Jan see attached
##   SocialInteraction InteractionwithMale Mating NearMating Consortship
## 1                 Y                   Y      N          N           N
## 2                 Y                   Y      N          N           N
## 3                 Y                   Y      N          N           Y
## 4                 Y                   Y      Y          Y           Y
## 5                 Y                   Y      Y          Y           Y
## 6                 Y                   Y      Y          Y           N
##   ObservationMinutes FollowType FollowTypeII Lengthofmating PelvicThrusts
## 1                731    F  full            F             NA            NA
## 2                712    F  full            F             NA            NA
## 3                788    F  full            F             NA            NA
## 4                667    F  full            F       0.003785            NA
## 5                667    F  full            F       0.004074            NA
## 6                806    F  full            F             NA            NA
##         Male MaletypeI MaleTypeII MaleTypeIII MatingTypeExcel
## 1 Jari Manis   Flanged Prime Male       Prime                
## 2 Jari Manis   Flanged Prime Male       Prime                
## 3 Subadult H Unflanged  Unflanged   Non-Prime                
## 4 Jari Manis   Flanged Prime Male       Prime     Cooperative
## 5 Jari Manis   Flanged Prime Male       Prime     Cooperative
## 6 Jari Manis   Flanged Prime Male       Prime                
##   MatingTypePercent MatingTypePercentII MatingTypeII MatingTypeIII
## 1                                                                 
## 2                                                                 
## 3                                                                 
## 4       Cooperative         Cooperative     Unforced    Unresisted
## 5       Cooperative         Cooperative     Unforced    Unresisted
## 6            Forced              Forced                           
##   Matingtypequestionable TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                                       NA
## 2                                                                       NA
## 3                                                                       NA
## 4                     No                                                 1
## 5                     No                                                 2
## 6                                                                        1
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                          NA                          NA
## 2                          NA                          NA
## 3                          NA                          NA
## 4                           1                          NA
## 5                          NA                           1
## 6                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                         NA                    NA                  NA
## 2                         NA                    NA                  NA
## 3                         NA                    NA                  NA
## 4                          1                   1.0                  NA
## 5                          1                   0.5                  NA
## 6                         NA                   0.0                  NA
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                    NA                                     NA
## 2                    NA                                     NA
## 3                    NA                                     NA
## 4                     0                                      1
## 5                     0                                      1
## 6                     0                                     NA
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                                NA                       NA
## 2                                NA                       NA
## 3                                NA                       NA
## 4                               1.0                       NA
## 5                               0.5                        1
## 6                               0.0                        1
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1              NA                       NA              NA
## 2              NA                       NA              NA
## 3              NA                       NA              NA
## 4             0.0                       NA               0
## 5             0.5                       NA               0
## 6             1.0                       NA               0
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                      NA                 NA                  NA        0
## 2                      NA                 NA                  NA        0
## 3                      NA                 NA                  NA        0
## 4                      NA                0.0                   2        1
## 5                       1                0.5                   3        1
## 6                       1                1.0                   1        0
##   POP preg lact prime past unflanged included endomiss
## 1   1    0    0     1    0         0        1        0
## 2   1    0    0     1    0         0        1        0
## 3   1    0    0     0    0         1        1        0
## 4   1    0    0     1    0         0        1        0
## 5   1    0    0     1    0         0        1        0
## 6   1    0    0     1    0         0        1        0

I created 6 more variables which serve as each entry of the replicated bar plot. The 3 female ovulatory statuses stay the same, though they are divided bewtween those who encountered prime males and those who encountered non-prime males (either unflanged or past-prime). For each variable I also counted the number of occurences of encounters by counting the number of rows. This is the same as what I did in the initial replication.

nonPOP_nonprime <- filter(nonPOP, prime == "0")
totalmatings1 <- length(attributes(nonPOP_nonprime)$row.names)
nonPOP_prime <- filter(nonPOP, prime == "1")
totalmatings2 <- length(attributes(nonPOP_prime)$row.names)
pregnant_nonprime <- filter(pregnant, prime == "0")
totalmatings3 <- length(attributes(pregnant_nonprime)$row.names)
pregnant_prime <- filter(pregnant, prime == "1")
totalmatings4 <- length(attributes(pregnant_prime)$row.names)
POP_nonprime <- filter(POP, prime == "0")
totalmatings5 <- length(attributes(POP_nonprime)$row.names)
POP_prime <- filter(POP, prime == "1")
totalmatings6 <- length(attributes(POP_prime)$row.names)

I then created a vector of each of the values of occurences.

v2 <- c(totalmatings1, totalmatings2, totalmatings3, totalmatings4, totalmatings5, totalmatings6)

barplot(v2, main = "Figure 2", xlab = "female endocrine status", ylab = "encounters observed", names.arg = c("non-periovulatory","non-periovulatory","pregnant","pregnant", "periovulatory", "periovulatory"), col = "black", density = c(100, 0, 100, 0, 100, 0), space = c(1, 0, 1, 0, 1, 0))

This is what the figure from the paper looks like:

This replication did not turn out the same as the original figure. The “pregnant” and “periovulatory” categories look correct, though the values for the “non-periovulatory” category are too low. Unsure how to fix this, I tried using a different file, which contained a shortened version of the interaction data.

Attempt 2

I loaded in the other converted file and created a new dataframe which only includes the observations which are in the final analysis:

# getting the data into R
library(curl)
f2 <- curl("https://raw.githubusercontent.com/natalierobinson96/data-reanalysis-assignment/master/interactions%20(short).csv")
d2 <- read.csv(f2, header = TRUE, sep = ",")
d2 <- filter(d2, InteractionwithMale == "Y")
head(d2)
##    Date     Name  Name2 Record.  TypeofInteraction FemaleAgeclass
## 1 34183 Betina O Betina     668                       Adol Female
## 2 34184 Betina O Betina     670        Consortship    Adol Female
## 3 34337 Betina P Betina     862                      Adult Female
## 4 34339 Betina P Betina     871        Consortship   Adult Female
## 5 35529    Ceska  Ceska      69 Sexual Interaction   Adult Female
## 6 35529    Ceska  Ceska    2858          Encounter   Adult Female
##   FemaleMotherClass OffspringClass ObservedReproductiveStatus
## 1       Adol Female                                          
## 2       Adol Female                                          
## 3            Mother                                          
## 4            Mother                                          
## 5            Mother     Inf no juv                           
## 6            Mother     Inf no juv                           
##   EndocrineStatusHormones CyclePhaseHormones ReproductiveStatus   Endo2
## 1                                                       No Data No Data
## 2                                                       No Data No Data
## 3                                                       No Data No Data
## 4                                                       No Data No Data
## 5                                                       No Data No Data
## 6                                                       No Data No Data
##     Endo3   Endo4   Endo5   Endo6   Endo7   Endo8 Pregnantvs.nonpregnant
## 1 No Data No Data No Data No Data No Data No Data                No Data
## 2 No Data No Data No Data No Data No Data No Data                No Data
## 3 No Data No Data No Data No Data No Data No Data                No Data
## 4 No Data No Data No Data No Data No Data No Data                No Data
## 5 No Data No Data No Data No Data No Data No Data                No Data
## 6 No Data No Data No Data No Data No Data No Data                No Data
##   E1CmgCr PDGmgCr CommentMET EndorineComment SocialInteraction
## 1      NA      NA                                            Y
## 2      NA      NA                                            Y
## 3      NA      NA                                            Y
## 4      NA      NA                                            Y
## 5      NA      NA                                            Y
## 6      NA      NA                                            Y
##   InteractionwithMale Mating NearMating Consortship ObservationMinutes
## 1                   Y      N          N           N                310
## 2                   Y      N          N           Y                369
## 3                   Y      N          N           N                805
## 4                   Y      N          N           N                805
## 5                   Y      N          Y           Y                740
## 6                   Y      N          Y           Y                740
##                  FollowType FollowTypeII Lengthofmating PelvicThrusts
## 1    D  found then full day                          NA            NA
## 2 S  Switched to another OH                          NA            NA
## 3          L  late full day            F             NA            NA
## 4          L  late full day            F       0.171528            NA
## 5                   F  full            F       0.239583            NA
## 6                   F  full            F       0.006944            NA
##             Male MaletypeI MaleTypeII MaleTypeIII MatingTypeExcel
## 1     Jari Manis   Flanged Prime Male       Prime                
## 2     Jari Manis   Flanged Prime Male       Prime                
## 3 Unflanged male Unflanged  Unflanged   Non-Prime                
## 4 Unflanged Male Unflanged  Unflanged   Non-Prime                
## 5         Fusuyo   Flanged Prime Male       Prime                
## 6          Roman   Flanged Past Prime   Non-Prime                
##   MatingTypePercent MatingTypePercentII MatingTypeII MatingTypeIII
## 1                                                                 
## 2                                                                 
## 3                                                                 
## 4                                                                 
## 5                                                                 
## 6                                                                 
##   Matingtypequestionable TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                                        0
## 2                                                                        0
## 3                                                                        0
## 4                                                                        0
## 5                                                                        0
## 6                                                                        0
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                           0                           0
## 2                           0                           0
## 3                           0                           0
## 4                           0                           0
## 5                           0                           0
## 6                           0                           0
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                          0                    NA                   0
## 2                          0                    NA                   0
## 3                          0                    NA                   0
## 4                          0                    NA                   0
## 5                          0                    NA                   0
## 6                          0                    NA                   0
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                    NA                                      0
## 2                    NA                                      0
## 3                    NA                                      0
## 4                    NA                                      0
## 5                    NA                                      0
## 6                    NA                                      0
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                                NA                        0
## 2                                NA                        0
## 3                                NA                        0
## 4                                NA                        0
## 5                                NA                        0
## 6                                NA                        0
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1              NA                        0              NA
## 2              NA                        0              NA
## 3              NA                        0              NA
## 4              NA                        0              NA
## 5              NA                        0              NA
## 6              NA                        0              NA
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors
## 1                       0                 NA                   0
## 2                       0                 NA                   0
## 3                       0                 NA                   0
## 4                       0                 NA                   0
## 5                       0                 NA                   0
## 6                       0                 NA                   0
##   MaleInspectionBehaviors AttractionAggression TotalAggressiveBehaviors
## 1                       0                    0                        0
## 2                       0                    0                        0
## 3                       0                    0                        0
## 4                       0                    0                        0
## 5                       0                    0                        0
## 6                       0                    0                        0
##   TotalJuvenileDistressBeforeBehaviors
## 1                                    0
## 2                                    0
## 3                                    0
## 4                                    0
## 5                                    0
## 6                                    0
##   TotalJuvenileDistressDuringBehaviors
## 1                                    0
## 2                                    0
## 3                                    0
## 4                                    0
## 5                                    0
## 6                                    0
##   NonResistantBeforeFemaleandmalesidebyside
## 1                                         0
## 2                                         0
## 3                                         0
## 4                                         0
## 5                                         0
## 6                                         0
##   NonResistantBeforeFemaleandmaleenternesttogether
## 1                                                0
## 2                                                0
## 3                                                0
## 4                                                0
## 5                                                0
## 6                                                0
##   NonResistantBeforeFemalenotangrytowardsmale
## 1                                           0
## 2                                           0
## 3                                           0
## 4                                           0
## 5                                           0
## 6                                           0
##   NonResistantDuringFemalecooperatiesatbeginningofmating
## 1                                                      0
## 2                                                      0
## 3                                                      0
## 4                                                      0
## 5                                                      0
## 6                                                      0
##   NonResistantDuringFemalecooperatesaftermatingbegins
## 1                                                   0
## 2                                                   0
## 3                                                   0
## 4                                                   0
## 5                                                   0
## 6                                                   0
##   ProceptiveBeforeFemaleApproachesMale
## 1                                    0
## 2                                    0
## 3                                    0
## 4                                    0
## 5                                    0
## 6                                    0
##   ProceptiveDuringFemalehelpswithintromission
## 1                                           0
## 2                                           0
## 3                                           0
## 4                                           0
## 5                                           0
## 6                                           0
##   ProceptiveDuringFemaletouchesmalegenitaliawithmouth
## 1                                                   0
## 2                                                   0
## 3                                                   0
## 4                                                   0
## 5                                                   0
## 6                                                   0
##   ProceptiveDuringFemalelickspenis ProceptiveDuringFemaleputspenisinmouth
## 1                                0                                      0
## 2                                0                                      0
## 3                                0                                      0
## 4                                0                                      0
## 5                                0                                      0
## 6                                0                                      0
##   ProceptiveDuringFemalespreadsmaleslegs
## 1                                      0
## 2                                      0
## 3                                      0
## 4                                      0
## 5                                      0
## 6                                      0
##   ProceptiveDuringFemalesitsontopofmale
## 1                                     0
## 2                                     0
## 3                                     0
## 4                                     0
## 5                                     0
## 6                                     0
##   ProceptiveDuringFemalepullsmalesleginsolicitation
## 1                                                 0
## 2                                                 0
## 3                                                 0
## 4                                                 0
## 5                                                 0
## 6                                                 0
##   ProceptiveDuringFemalepullsmalesarminsolicitation
## 1                                                 0
## 2                                                 0
## 3                                                 0
## 4                                                 0
## 5                                                 0
## 6                                                 0
##   ProceptiveDuringFemaleperformspelvicthrusts ProceptiveDuringFemalecoos
## 1                                           0                          0
## 2                                           0                          0
## 3                                           0                          0
## 4                                           0                          0
## 5                                           0                          0
## 6                                           0                          0
##   ProceptiveDuringFemalelaysdownontopofmale
## 1                                         0
## 2                                         0
## 3                                         0
## 4                                         0
## 5                                         0
## 6                                         0
##   ProceptiveDuringFemaleputslegontopofmale
## 1                                        0
## 2                                        0
## 3                                        0
## 4                                        0
## 5                                        0
## 6                                        0
##   ProceptiveDuringFemalemalefacetoface
## 1                                    0
## 2                                    0
## 3                                    0
## 4                                    0
## 5                                    0
## 6                                    0
##   ProceptiveDuringFemaledisplaysgenitalstomale
## 1                                            0
## 2                                            0
## 3                                            0
## 4                                            0
## 5                                            0
## 6                                            0
##   ResistanceBeforeFemaleafraid ResistanceBeforeFemaleangry
## 1                            0                           0
## 2                            0                           0
## 3                            0                           0
## 4                            0                           0
## 5                            0                           0
## 6                            0                           0
##   ResistanceBeforeFemalevocalizesagainistmaleapproach
## 1                                                   0
## 2                                                   0
## 3                                                   0
## 4                                                   0
## 5                                                   0
## 6                                                   0
##   ResistanceBeforeFemalemakessmallnoise ResistanceBeforeFemalelork
## 1                                     0                          0
## 2                                     0                          0
## 3                                     0                          0
## 4                                     0                          0
## 5                                     0                          0
## 6                                     0                          0
##   ResistanceBeforeFemalegroan ResistanceBeforeFemaledistressvocalization
## 1                           0                                          0
## 2                           0                                          0
## 3                           0                                          0
## 4                           0                                          0
## 5                           0                                          0
## 6                           0                                          0
##   ResistanceBeforeFemalevocalizesgutteralnoise
## 1                                            0
## 2                                            0
## 3                                            0
## 4                                            0
## 5                                            0
## 6                                            0
##   ResistanceBeforeFemalerunsawayformmale
## 1                                      0
## 2                                      0
## 3                                      0
## 4                                      0
## 5                                      0
## 6                                      0
##   ResistanceBeforeFemalemovesawayfrommale
## 1                                       0
## 2                                       0
## 3                                       0
## 4                                       0
## 5                                       0
## 6                                       0
##   ResistanceBeforeFemaleaggressivetowardsmale
## 1                                           0
## 2                                           0
## 3                                           0
## 4                                           0
## 5                                           0
## 6                                           0
##   ResistanceBeforeFemaleurinates ResistanceDuringafraid
## 1                              0                      0
## 2                              0                      0
## 3                              0                      0
## 4                              0                      0
## 5                              0                      0
## 6                              0                      0
##   ResistanceDuringangry ResistanceDuringmakessamllnoise
## 1                     0                               0
## 2                     0                               0
## 3                     0                               0
## 4                     0                               0
## 5                     0                               0
## 6                     0                               0
##   ResistanceDuringlork ResistanceDuringgroan
## 1                    0                     0
## 2                    0                     0
## 3                    0                     0
## 4                    0                     0
## 5                    0                     0
## 6                    0                     0
##   ResistanceDuringdistressvocalization ResistanceDuringgiutteralnoise
## 1                                    0                              0
## 2                                    0                              0
## 3                                    0                              0
## 4                                    0                              0
## 5                                    0                              0
## 6                                    0                              0
##   ResistanceDuringFemaletrystopullaway
## 1                                    0
## 2                                    0
## 3                                    0
## 4                                    0
## 5                                    0
## 6                                    0
##   ResistanceDuringfemalestrugglesaganstmale
## 1                                         0
## 2                                         0
## 3                                         0
## 4                                         0
## 5                                         0
## 6                                         0
##   ResistanceDuringFemaleaggressivetowardsmaleduringmating
## 1                                                       0
## 2                                                       0
## 3                                                       0
## 4                                                       0
## 5                                                       0
## 6                                                       0
##   ResistanceDuringfemaleurinates AttractionMaleapproachesfemale
## 1                              0                              0
## 2                              0                              0
## 3                              0                              0
## 4                              0                              0
## 5                              0                              0
## 6                              0                              0
##   AttractionMaletouchesfemalegenitaliawithmouth
## 1                                             0
## 2                                             0
## 3                                             0
## 4                                             0
## 5                                             0
## 6                                             0
##   AttractionMalesniffsfemalegenitals
## 1                                  0
## 2                                  0
## 3                                  0
## 4                                  0
## 5                                  0
## 6                                  0
##   AttractionMaletouchesopensfemalegenitals
## 1                                        0
## 2                                        0
## 3                                        0
## 4                                        0
## 5                                        0
## 6                                        0
##   AttractionMalesmellskissesfemalehand AttractionMalerubsfemalenongenitals
## 1                                    0                                   0
## 2                                    0                                   0
## 3                                    0                                   0
## 4                                    0                                   0
## 5                                    0                                   0
## 6                                    0                                   0
##   AttractionMalelicksspermfromfemalegenitalia
## 1                                           0
## 2                                           0
## 3                                           0
## 4                                           0
## 5                                           0
## 6                                           0
##   AttractionMalespreadsfemaleslegsforinspection
## 1                                             0
## 2                                             0
## 3                                             0
## 4                                             0
## 5                                             0
## 6                                             0
##   AttractionMalemoansduringmating AggressionsMaleforcesapartfemalelegs
## 1                               0                                    0
## 2                               0                                    0
## 3                               0                                    0
## 4                               0                                    0
## 5                               0                                    0
## 6                               0                                    0
##   AggressionsMaleholdsfemale AggressionsMalechasesfemale
## 1                          0                           0
## 2                          0                           0
## 3                          0                           0
## 4                          0                           0
## 5                          0                           0
## 6                          0                           0
##   AggressionsMalegrabsfemale AggressionsMalepullsfemalelegfoot
## 1                          0                                 0
## 2                          0                                 0
## 3                          0                                 0
## 4                          0                                 0
## 5                          0                                 0
## 6                          0                                 0
##   AggressionsMalepullsfemalearmhand AggressionsMalepullsfemaledown
## 1                                 0                              0
## 2                                 0                              0
## 3                                 0                              0
## 4                                 0                              0
## 5                                 0                              0
## 6                                 0                              0
##   AggressionsMalehitsfemaleleg AggressionsMalebitesfemalelightly
## 1                            0                                 0
## 2                            0                                 0
## 3                            0                                 0
## 4                            0                                 0
## 5                            0                                 0
## 6                            0                                 0
##   AggressionsMalehitsfemalelightly AggressionsMaleholdsfemaleonlap
## 1                                0                               0
## 2                                0                               0
## 3                                0                               0
## 4                                0                               0
## 5                                0                               0
## 6                                0                               0
##   AggressionsMaleembracesfemale AggressionsMalepositionsfemaleformating
## 1                             0                                       0
## 2                             0                                       0
## 3                             0                                       0
## 4                             0                                       0
## 5                             0                                       0
## 6                             0                                       0
##   AggressionsMalesitsontopoffemale AggressionsMalelaysdownontopoffemale
## 1                                0                                    0
## 2                                0                                    0
## 3                                0                                    0
## 4                                0                                    0
## 5                                0                                    0
## 6                                0                                    0
##   AggressionMalegrumphs AggressionMalekissgrunts Juvenilebeforeafraid
## 1                     0                        0                    0
## 2                     0                        0                    0
## 3                     0                        0                    0
## 4                     0                        0                    0
## 5                     0                        0                    0
## 6                     0                        0                    0
##   Juvenilebeforeangry Juvenilebeforecrys Juvenilebeforevocalizes
## 1                   0                  0                       0
## 2                   0                  0                       0
## 3                   0                  0                       0
## 4                   0                  0                       0
## 5                   0                  0                       0
## 6                   0                  0                       0
##   Juvenilebeforeurinates Juvenilebeforemaletouchesjuvenile
## 1                      0                                 0
## 2                      0                                 0
## 3                      0                                 0
## 4                      0                                 0
## 5                      0                                 0
## 6                      0                                 0
##   Juvenilebeforemalepullsjuvenile JuvenileDuringJuvenilehitsmale
## 1                               0                              0
## 2                               0                              0
## 3                               0                              0
## 4                               0                              0
## 5                               0                              0
## 6                               0                              0
##   JuvenileDuringJuvenilebitesmale
## 1                               0
## 2                               0
## 3                               0
## 4                               0
## 5                               0
## 6                               0
##   JuvenileDuringJuveniletriestopullmaleofffemale
## 1                                              0
## 2                                              0
## 3                                              0
## 4                                              0
## 5                                              0
## 6                                              0
##   JuvenileDuringJuveniletriestointerfere JuvenileDuringafraid
## 1                                      0                    0
## 2                                      0                    0
## 3                                      0                    0
## 4                                      0                    0
## 5                                      0                    0
## 6                                      0                    0
##   JuvenileDuringangry JuvenileDuringcrys JuvenileDuringvocalizes
## 1                   0                  0                       0
## 2                   0                  0                       0
## 3                   0                  0                       0
## 4                   0                  0                       0
## 5                   0                  0                       0
## 6                   0                  0                       0
##   JuvenileDuringurinates JuvenileDuringmaletouchesjuvenile
## 1                      0                                 0
## 2                      0                                 0
## 3                      0                                 0
## 4                      0                                 0
## 5                      0                                 0
## 6                      0                                 0
##   JuvenileDuringmalepushesjuvenileaway Malehangingbelowfemale
## 1                                    0                      0
## 2                                    0                      0
## 3                                    0                      0
## 4                                    0                      0
## 5                                    0                      0
## 6                                    0                      0
##   Malehangsabovefemale Femalelyingdownundermale Femalesitsbelowmale
## 1                    0                        0                   0
## 2                    0                        0                   0
## 3                    0                        0                   0
## 4                    0                        0                   0
## 5                    0                        0                   0
## 6                    0                        0                   0
##   Malerejectsfemaleadvance Mating01  maletype2 male2miss femendo prime POP
## 1                        0        0 Prime Male         3      NA     1  NA
## 2                        0        0 Prime Male         3      NA     1  NA
## 3                        0        0  Unflanged         1      NA     0  NA
## 4                        0        0  Unflanged         1      NA     0  NA
## 5                        0        0 Prime Male         3      NA     1  NA
## 6                        0        0 Past Prime         2      NA    NA  NA
##   nPOP CYCN POPprime nPOPprime POPnprime nPOPnprime CYCprime CYCNprime
## 1   NA   NA       NA        NA         0          0       NA        NA
## 2   NA   NA       NA        NA         0          0       NA        NA
## 3   NA   NA        0         0        NA         NA        0         0
## 4   NA   NA        0         0        NA         NA        0         0
## 5   NA   NA       NA        NA         0          0       NA        NA
## 6   NA   NA       NA        NA        NA         NA       NA        NA
##   POPint nPOPint filter_. preglact
## 1     NA      NA        1       NA
## 2     NA      NA        1       NA
## 3      0       0        1       NA
## 4      0       0        1       NA
## 5     NA      NA        1       NA
## 6     NA      NA        1       NA

This file already had the interactions divided into columns of the 6 categories for the barplot, so I filtered these out.

nonPOP_nonprime <- filter(d2, nPOPnprime == "1")
totalmatings1 <- length(attributes(nonPOP_nonprime)$row.names)
nonPOP_prime <- filter(d2, nPOPprime == "1")
totalmatings2 <- length(attributes(nonPOP_prime)$row.names)
pregnant_nonprime <- filter(d2, CYCNprime == "1")
totalmatings3 <- length(attributes(pregnant_nonprime)$row.names)
pregnant_prime <- filter(d2, CYCprime == "1")
totalmatings4 <- length(attributes(pregnant_prime)$row.names)
POP_nonprime <- filter(d2, POPnprime == "1")
totalmatings5 <- length(attributes(POP_nonprime)$row.names)
POP_prime <- filter(d2, POPprime == "1")
totalmatings6 <- length(attributes(POP_prime)$row.names)

I then created a vector of each of the values of occurences.

v2 <- c(totalmatings1, totalmatings2, totalmatings3, totalmatings4, totalmatings5, totalmatings6)

barplot(v2, main = "Figure 2", xlab = "female endocrine status", ylab = "encounters observed", names.arg = c("non-periovulatory","non-periovulatory","pregnant","pregnant", "periovulatory", "periovulatory"), col = "black", density = c(100, 0, 100, 0, 100, 0), space = c(1, 0, 1, 0, 1, 0))

Here, the “periovulatory” columns remain correct, the “pregnant” columns are now too high, and the “non-periovulatory” columns remain incorrect.

Attempt 3

After trying more iterations of code with both of the files, I noticed a column titled “endomiss” in the original long version of the interactions file. This column is filled in for each interaciton observation with either a “0” or “1”. My best guess is that this indicates whether or not the endocrine data from urine samples is missing or not. “0” would indicate that it is not missing (so the interaction can be used), while “1” would indicate that the endocrine data is missing, and should be excluded from the analysis. I added this into the filter of my original code to see if it would help me.

First, I loaded the original set of data in to R.

library(curl)
f2 <- curl("https://raw.githubusercontent.com/natalierobinson96/data-reanalysis-assignment/master/interactions.csv")
d2 <- read.csv(f2, header = TRUE, sep = ",")

Next I created a new dataframe which only includes the observation entries which were included in the final analysis.

d2 <- filter(d2, InteractionwithMale == "Y")
d2 <- filter(d2, included == "1")
d2 <- filter(d2, endomiss == "0")
head(d2) # I got it down to the 153 observations!!
##    Date day year    year2   DateSPSS      Name     Name2 Record.
## 1 34340   7   94 94.01780 01/07/1994 Elizabeth Elizabeth      31
## 2 34343  10   94 94.02601 01/10/1994 Elizabeth Elizabeth      40
## 3 34309 341   93 93.93292 12/07/1993 Elizabeth Elizabeth     830
## 4 34342   9   94 94.02327 01/09/1994 Elizabeth Elizabeth     879
## 5 34344  11   94 94.02875 01/11/1994 Elizabeth Elizabeth     882
## 6 34380  47   94 94.12731 02/16/1994 Elizabeth Elizabeth     942
##              TypeofInteraction FemaleAgeclass FemaleMotherClass
## 1                     Mating 1   Adult Female            Mother
## 2                  Consortship   Adult Female            Mother
## 3                                Adult Female            Mother
## 4 Female companion consortship   Adult Female            Mother
## 5 Female companion consortship   Adult Female            Mother
## 6                                Adult Female            Mother
##   OffspringClass ObservedReproductiveStatus EndocrineStatusHormones
## 1     Inf no juv                         L4                        
## 2     Inf no juv                         L4                 cycling
## 3     Inf no juv                         L4                 cycling
## 4     Inf no juv                         L4                 cycling
## 5     Inf no juv                         L4                 cycling
## 6     Inf no juv                         L4                        
##   CyclePhaseHormones ReproductiveStatus   Endo2   Endo3   Endo4   Endo5
## 1                               Cycling non-POP Cycling     POP     POP
## 2            non-pop            Cycling non-POP non-POP non-POP non-POP
## 3            non-pop            Cycling non-POP non-POP non-POP non-POP
## 4            non-pop            Cycling non-POP non-POP non-POP non-POP
## 5            non-pop            Cycling non-POP non-POP non-POP non-POP
## 6                               Cycling non-POP non-POP non-POP non-POP
##      Endo6   Endo7   Endo8 Pregnantvs.nonpregnant E1CmgCr PDGmgCr
## 1 Near-POP     POP non-POP               Non-Preg      NA      NA
## 2  non-POP non-POP non-POP               Non-Preg   14253    1803
## 3  non-POP non-POP non-POP               Non-Preg   12658     308
## 4  non-POP non-POP non-POP               Non-Preg   19305    3818
## 5  non-POP non-POP non-POP               Non-Preg   22809    3678
## 6  non-POP non-POP non-POP               Non-Preg      NA      NA
##   CommentMET
## 1           
## 2     luteal
## 3  low E & P
## 4     luteal
## 5     luteal
## 6           
##                                                                 EndorineComment
## 1 High P 6 Jan-16 Jan, no data when E peak occurred, looks just after ovulation
## 2                                                                              
## 3                                                                              
## 4                                                                              
## 5                                                                              
## 6                                                                              
##   SocialInteraction InteractionwithMale Mating NearMating Consortship
## 1                 Y                   Y      Y          N           Y
## 2                 Y                   Y      N          N           Y
## 3                 Y                   Y      N          N           N
## 4                 Y                   Y      N          N           N
## 5                 Y                   Y      N          N           N
## 6                 Y                   Y      N          N  don't know
##   ObservationMinutes       FollowType FollowTypeII Lengthofmating
## 1                785 L  late full day            F       0.001389
## 2                802          F  full            F             NA
## 3                635          F  full            F             NA
## 4                688 L  late full day            F             NA
## 5                660          F  full            F             NA
## 6                719          F  full            F             NA
##   PelvicThrusts           Male MaletypeI MaleTypeII MaleTypeIII
## 1            10         Gagung Unflanged  Unflanged   Non-Prime
## 2            NA Unflanged Male Unflanged  Unflanged   Non-Prime
## 3            NA          Roman   Flanged Prime Male       Prime
## 4            NA Unflanged male Unflanged  Unflanged   Non-Prime
## 5            NA           Toby Unflanged  Unflanged   Non-Prime
## 6            NA     Jari Manis   Flanged Prime Male       Prime
##   MatingTypeExcel MatingTypePercent MatingTypePercentII MatingTypeII
## 1     Cooperative       Cooperative         Cooperative     Unforced
## 2                                                                   
## 3                                                                   
## 4                                                                   
## 5                                                                   
## 6                                                                   
##   MatingTypeIII Matingtypequestionable
## 1    Unresisted                     No
## 2                                     
## 3                                     
## 4                                     
## 5                                     
## 6                                     
##   TotalnonresistantProceptiveandResistanceBehaviors
## 1                                                 3
## 2                                                NA
## 3                                                NA
## 4                                                NA
## 5                                                NA
## 6                                                NA
##   NonResistantBeforeBehaviors NonResistantDuringBehaviors
## 1                           1                          NA
## 2                          NA                          NA
## 3                          NA                          NA
## 4                          NA                          NA
## 5                          NA                          NA
## 6                          NA                          NA
##   Totalnonresistantbehaviors NonresistantBehaviors ProceptiveBehaviors
## 1                          1                  0.33                   1
## 2                         NA                    NA                  NA
## 3                         NA                    NA                  NA
## 4                         NA                    NA                  NA
## 5                         NA                    NA                  NA
## 6                         NA                    NA                  NA
##   ProceptiveBehaviors_A TotalunresistedandProcepetivebehaviors
## 1                  0.33                                      2
## 2                    NA                                     NA
## 3                    NA                                     NA
## 4                    NA                                     NA
## 5                    NA                                     NA
## 6                    NA                                     NA
##   unresistedandProcepetivebehaviors ResistantBeforeBehaviors
## 1                              0.67                        1
## 2                                NA                       NA
## 3                                NA                       NA
## 4                                NA                       NA
## 5                                NA                       NA
## 6                                NA                       NA
##   BeforeBehaviors ResistantDuringBehaviors DuringBehaviors
## 1            0.33                       NA               0
## 2              NA                       NA              NA
## 3              NA                       NA              NA
## 4              NA                       NA              NA
## 5              NA                       NA              NA
## 6              NA                       NA              NA
##   TotalResistantBehaviors ResistantBehaviors AttractionBehaviors Mating01
## 1                       1               0.33                   3        1
## 2                      NA                 NA                  NA        0
## 3                      NA                 NA                  NA        0
## 4                      NA                 NA                  NA        0
## 5                      NA                 NA                  NA        0
## 6                      NA                 NA                  NA        0
##   POP preg lact prime past unflanged included endomiss
## 1   0    0    0     0    0         1        1        0
## 2   0    0    0     0    0         1        1        0
## 3   0    0    0     1    0         0        1        0
## 4   0    0    0     0    0         1        1        0
## 5   0    0    0     0    0         1        1        0
## 6   0    0    0     1    0         0        1        0

Finally, this dataframe contains 153 rows – the correct number of observations!

As before, I created the 3 categories of female endocrine status:

nonPOP <- filter(d2, preg == "0" & POP == "0") #matings with females not in periovulatory period; currently cycling
pregnant <- filter(d2, preg == "1") #matings with pregnant females 
POP <- filter(d2, POP == "1") #matings with females in periovulatory period

Then I created 6 more variables which will serve as each entry of the replicated bar plot. The 3 female ovulatory statuses stay the same, though they are divided bewtween those who encountered prime males and those who encountered non-prime males (either unflanged or past-prime). For each variable I also counted the number of occurences of encounters by counting the number of rows.

nonPOP_nonprime <- filter(nonPOP, prime == "0")
totalmatings1 <- length(attributes(nonPOP_nonprime)$row.names)
nonPOP_prime <- filter(nonPOP, prime == "1")
totalmatings2 <- length(attributes(nonPOP_prime)$row.names)
pregnant_nonprime <- filter(pregnant, prime == "0")
totalmatings3 <- length(attributes(pregnant_nonprime)$row.names)
pregnant_prime <- filter(pregnant, prime == "1")
totalmatings4 <- length(attributes(pregnant_prime)$row.names)
POP_nonprime <- filter(POP, prime == "0")
totalmatings5 <- length(attributes(POP_nonprime)$row.names)
POP_prime <- filter(POP, prime == "1")
totalmatings6 <- length(attributes(POP_prime)$row.names)

I then created a vector of each of the values of occurences.

v2 <- c(totalmatings1, totalmatings2, totalmatings3, totalmatings4, totalmatings5, totalmatings6)

barplot(v2, main = "Figure 2", xlab = "female endocrine status", ylab = "encounters observed", names.arg = c("non-periovulatory","non-periovulatory","pregnant","pregnant", "periovulatory", "periovulatory"), col = "black", density = c(100, 0, 100, 0, 100, 0), space = c(1, 0, 1, 0, 1, 0))

Again, this is what the figure from the paper looks like:

They are the same!

Though the code for creating this graph is simple, the difficult part of replication was sorting through all the data that was sent to me. I was given separate spreadsheets (of various different formats) from different dates containing different data. This made it very difficult to figure out which data I should use for each part of the replication. This has taught me an important lesson for my own future research/data collection. A cleaner/simpler dataset allows less room for error in analysis and is overall more user-friendly.

Linear Mixed Model Analysis (Inferential)

To make sense of this data, Knott et al. (2010) used linear mixed model analyses. As explained in the paper, all random effects were intercept only and used female identity as the subject identifier. Male identity was not used to characterize non-independence because male inclusion in the observations was not under researcher control. Additionally, female reproductive status varies substantially more than the male-specific variable of prime vs. non-prime.

For binary outcomes (such as type of male encountered and the occurence of mating), mixed logistic models were used. The authors used the logit.mixed procedure in R, though this package is no longer available. Instead, I will use the glmer() function in the lme4 package for my replication.

For continuous outcomes (such as the number of resistant behaviors observed), the authors used mixed linear models. This was done in an SPSS program called MIXED. I will use the lmer() function in the lme4 package. The same modelling was done for the association between male and female behavior during mating interactions, though log-transformed variables were used for analysis and were then returned to linear values for reporting of estimates.

Linear Mixed Model Analysis of Female and Male Behaviors Observed During Copulation (Table 1)

Table 1 in the paper (below) shows the results of linear mixed model analyses of different female and male behaviors during mating. The behaviors in each category were skewed, so log-transformed variables were used for analysis. The authors used female reproductive status and male type as main effects. In separate models, the interaction of female reproductive status and male type were included to test the primary hypotheses. Results are reported as F statistics, meaning an ANOVA was done to test the significant differences between models. The rows indicate the type of behavior, and the columns indicate which variable was left in the model when being compared with the full model (with female reproductive status and male type).

The authors decided that in order to investigate the distribution of male and female behaviors within matings, they needed to use a more inclusive dataset (rather than the 22 observations of mating where all reproductive statuses were known). Thus, observations of mating with unclassified reproductive state were assumed to be non-periovulatory, as this is the state in which females are most likely to be in due to their long inter-birth intervals. This prevents having categories with zero observations and creates a larger sample size.

First I loaded in the dataset and altered the dataframe so that only the relevant columns were showing.

f <- curl("https://raw.githubusercontent.com/natalierobinson96/data-reanalysis-assignment/master/ohmatingspss2.csv")
d4 <- read.csv(f, header = TRUE, sep = ",")
d4 <- select(d4, FEMALE, FReproStatus, MALE, MALE.AGE.CLASS.I, TOTAL.PROCEPTIVE, TOTAL.RESISTANCE, MALE.AGGRESSION)
head(d4)
##                                          FEMALE FReproStatus
## 1 Elizabeth                                           nonPOP
## 2 Marissa                                             nonPOP
## 3 Marissa                                             nonPOP
## 4 Marissa                                             nonPOP
## 5 Marissa                                             nonPOP
## 6 FL01Sep99                                           nonPOP
##                             MALE               MALE.AGE.CLASS.I
## 1 Gagung                         Unflanged                     
## 2 Jari Manis                     Flanged                       
## 3 Jari Manis                     Flanged                       
## 4 Jari Manis                     Flanged                       
## 5 UML31Jan95                     Unflanged                     
## 6 Dony                           Unflanged                     
##   TOTAL.PROCEPTIVE TOTAL.RESISTANCE MALE.AGGRESSION
## 1                1                1               1
## 2                1               NA               4
## 3                1                1               2
## 4                1                1               3
## 5               NA                1              NA
## 6               NA                1              NA
summary(d4)
##                                             FEMALE     FReproStatus
##  Marissa                                       :10   nonPOP  :31   
##  Kristen                                       : 6   POP     : 4   
##  Kayla                                         : 4   Pregnant: 7   
##  Zarina                                        : 4                 
##  Shea                                          : 3                 
##  AF10Jan98\v                                   : 2                 
##  (Other)                                       :13                 
##                              MALE   
##  Jari Manis                    : 8  
##  Roman                         : 4  
##  Wendell                       : 4  
##  Male V                        : 3  
##  Rob                           : 3  
##  Dony                          : 2  
##  (Other)                       :18  
##                        MALE.AGE.CLASS.I TOTAL.PROCEPTIVE TOTAL.RESISTANCE
##  Flanged                       :17      Min.   :1.000    Min.   : 1      
##  Unflanged                     :25      1st Qu.:1.000    1st Qu.: 1      
##                                         Median :1.000    Median : 1      
##                                         Mean   :1.783    Mean   : 2      
##                                         3rd Qu.:1.500    3rd Qu.: 2      
##                                         Max.   :8.000    Max.   :10      
##                                         NA's   :19       NA's   :23      
##  MALE.AGGRESSION
##  Min.   :1.000  
##  1st Qu.:1.000  
##  Median :2.000  
##  Mean   :2.591  
##  3rd Qu.:3.750  
##  Max.   :7.000  
##  NA's   :20

As done in Module 18, I began with some exploratory visualization. First, I looked at the proceptive behaviors from females in relation to each individual female. This plot shows that there is a lot of variation between the number of proceptive behaviors observed between different females. This is why the female ID was treated as a random effect.

par(mfrow = c(1, 1))
boxplot(data = d4, TOTAL.PROCEPTIVE ~ FEMALE, col = c("lightpink1"))

This plot shows that the most proceptive behaviors came from females in their periovulatory period.

boxplot(data = d4, TOTAL.PROCEPTIVE ~ FReproStatus, col = c("burlywood2", "lightpink1", "lightblue"))

More proceptive behaviors were directed towards flanged males.

boxplot(data = d4, TOTAL.PROCEPTIVE ~ MALE.AGE.CLASS.I, col = c("burlywood2", "lightpink1"))

boxplot(data = d4, TOTAL.RESISTANCE ~ FReproStatus * MALE.AGE.CLASS.I, col = c("burlywood2", "lightpink1", "lightgreen", "lightblue"))

Then I began the replication of the row in which the response variable is “female proceptive behaviours”.

library(lme4)
lme <- lmer(data = d4, TOTAL.PROCEPTIVE ~ FReproStatus + MALE.AGE.CLASS.I + FReproStatus:MALE.AGE.CLASS.I + (1 | FEMALE))
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
summary(lme)
## Linear mixed model fit by REML ['lmerMod']
## Formula: 
## TOTAL.PROCEPTIVE ~ FReproStatus + MALE.AGE.CLASS.I + FReproStatus:MALE.AGE.CLASS.I +  
##     (1 | FEMALE)
##    Data: d4
## 
## REML criterion at convergence: 71.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.6202 -0.1736  0.0000  0.0000  3.2404 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  FEMALE   (Intercept) 0.000    0.00    
##  Residual             2.074    1.44    
## Number of obs: 23, groups:  FEMALE, 11
## 
## Fixed effects:
##                                                                     Estimate
## (Intercept)                                                           1.0000
## FReproStatusPOP                                                       2.3333
## FReproStatusPregnant                                                  3.5000
## MALE.AGE.CLASS.IUnflanged                                             0.2500
## FReproStatusPregnant:MALE.AGE.CLASS.IUnflanged                       -3.0833
##                                                                     Std. Error
## (Intercept)                                                             0.5443
## FReproStatusPOP                                                         0.9938
## FReproStatusPregnant                                                    1.1547
## MALE.AGE.CLASS.IUnflanged                                               0.7454
## FReproStatusPregnant:MALE.AGE.CLASS.IUnflanged                          1.5113
##                                                                     t value
## (Intercept)                                                           1.837
## FReproStatusPOP                                                       2.348
## FReproStatusPregnant                                                  3.031
## MALE.AGE.CLASS.IUnflanged                                             0.335
## FReproStatusPregnant:MALE.AGE.CLASS.IUnflanged                       -2.040
## 
## Correlation of Fixed Effects:
##             (Intr) FRSPOP FRprSP MALE.A
## FRprSttsPOP -0.548                     
## FRprSttsPrg -0.471  0.258              
## MALE.AGE.CL -0.730  0.400  0.344       
## FRSP:MALE.A  0.360 -0.197 -0.764 -0.493
## fit warnings:
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
coefficients(lme)
## $FEMALE
##                                                (Intercept) FReproStatusPOP
## AF10Jan98\v                                              1        2.333333
## Beth                                                     1        2.333333
## Elizabeth                                                1        2.333333
## Emilia Kontessa                                          1        2.333333
## Jinjer                                                   1        2.333333
## Kayla                                                    1        2.333333
## Kristen                                                  1        2.333333
## Marissa                                                  1        2.333333
## Martha                                                   1        2.333333
## Shea                                                     1        2.333333
## Zarina                                                   1        2.333333
##                                                FReproStatusPregnant
## AF10Jan98\v                                                     3.5
## Beth                                                            3.5
## Elizabeth                                                       3.5
## Emilia Kontessa                                                 3.5
## Jinjer                                                          3.5
## Kayla                                                           3.5
## Kristen                                                         3.5
## Marissa                                                         3.5
## Martha                                                          3.5
## Shea                                                            3.5
## Zarina                                                          3.5
##                                                MALE.AGE.CLASS.IUnflanged                     
## AF10Jan98\v                                                                              0.25
## Beth                                                                                     0.25
## Elizabeth                                                                                0.25
## Emilia Kontessa                                                                          0.25
## Jinjer                                                                                   0.25
## Kayla                                                                                    0.25
## Kristen                                                                                  0.25
## Marissa                                                                                  0.25
## Martha                                                                                   0.25
## Shea                                                                                     0.25
## Zarina                                                                                   0.25
##                                                FReproStatusPregnant:MALE.AGE.CLASS.IUnflanged                     
## AF10Jan98\v                                                                                              -3.083333
## Beth                                                                                                     -3.083333
## Elizabeth                                                                                                -3.083333
## Emilia Kontessa                                                                                          -3.083333
## Jinjer                                                                                                   -3.083333
## Kayla                                                                                                    -3.083333
## Kristen                                                                                                  -3.083333
## Marissa                                                                                                  -3.083333
## Martha                                                                                                   -3.083333
## Shea                                                                                                     -3.083333
## Zarina                                                                                                   -3.083333
## 
## attr(,"class")
## [1] "coef.mer"

I began by creating the full model, in which both female reproductive status and male type are included as main effects. I also took the log of the number of resistant behaviors, as the authors explained they used log-transformed variables (reproductive status and male type are categorical, so the log can not be done on those variables).

full <- lmer(data = d4, log(TOTAL.PROCEPTIVE) ~ FReproStatus + MALE.AGE.CLASS.I + (1 | FEMALE))
summary(full)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(TOTAL.PROCEPTIVE) ~ FReproStatus + MALE.AGE.CLASS.I + (1 |  
##     FEMALE)
##    Data: d4
## 
## REML criterion at convergence: 38.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.5078 -0.3251 -0.0887  0.3500  2.5414 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  FEMALE   (Intercept) 0.05705  0.2389  
##  Residual             0.26372  0.5135  
## Number of obs: 23, groups:  FEMALE, 11
## 
## Fixed effects:
##                                                Estimate Std. Error t value
## (Intercept)                                      0.2359     0.2193   1.075
## FReproStatusPOP                                  0.4539     0.3789   1.198
## FReproStatusPregnant                             0.7320     0.2991   2.447
## MALE.AGE.CLASS.IUnflanged                       -0.1805     0.2625  -0.688
## 
## Correlation of Fixed Effects:
##             (Intr) FRSPOP FRprSP
## FRprSttsPOP -0.472              
## FRprSttsPrg -0.263  0.095       
## MALE.AGE.CL -0.690  0.380 -0.099

Then I created a reduced model, in which only the female reproductive status is considered.

reduced1 <- lmer(data = d4, log(TOTAL.PROCEPTIVE) ~ FReproStatus + (1 | FEMALE))
summary(reduced1)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(TOTAL.PROCEPTIVE) ~ FReproStatus + (1 | FEMALE)
##    Data: d4
## 
## REML criterion at convergence: 38
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.4589 -0.2893 -0.0335  0.2873  2.5830 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  FEMALE   (Intercept) 0.04329  0.2081  
##  Residual             0.26468  0.5145  
## Number of obs: 23, groups:  FEMALE, 11
## 
## Fixed effects:
##                      Estimate Std. Error t value
## (Intercept)            0.1259     0.1537   0.819
## FReproStatusPOP        0.5611     0.3463   1.620
## FReproStatusPregnant   0.7124     0.2919   2.441
## 
## Correlation of Fixed Effects:
##             (Intr) FRSPOP
## FRprSttsPOP -0.331       
## FRprSttsPrg -0.469  0.155

Finally, I did an ANOVA comparing the full and reduced models in order to obtain the F-Statistic.

anova(reduced1, full, test = "F")
## refitting model(s) with ML (instead of REML)
## Data: d4
## Models:
## reduced1: log(TOTAL.PROCEPTIVE) ~ FReproStatus + (1 | FEMALE)
## full: log(TOTAL.PROCEPTIVE) ~ FReproStatus + MALE.AGE.CLASS.I + (1 | 
## full:     FEMALE)
##          Df    AIC    BIC  logLik deviance  Chisq Chi Df Pr(>Chisq)
## reduced1  5 44.506 50.184 -17.253   34.506                         
## full      6 46.015 52.828 -17.008   34.015 0.4914      1     0.4833

This ANOVA (using the anova() function in the {stats} package) provided me with a Chi squared value rather than an F-Statistic (as used in the paper).

I then used the Anova() function in the {car} package to obtain the F-Statistic.

library(car)
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
Anova(reduced1, full, type = c("II", "III", 2, 3), test = "F")
## Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
## 
## Response: log(TOTAL.PROCEPTIVE)
##                   F Df Df.res  Pr(>F)  
## FReproStatus 3.0642  2 18.085 0.07144 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

This result is different than what was found in the paper. It should be F(2,35.4) = 12.9, p < 0.001 (which is displayed in the first row and first column of Table 1)

I then created a second recuded model in which only the male type is considered.

reduced2 <- lmer(data = d4, log(TOTAL.RESISTANCE) ~ MALE.AGE.CLASS.I + (1 | FEMALE))
summary(reduced2)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(TOTAL.RESISTANCE) ~ MALE.AGE.CLASS.I + (1 | FEMALE)
##    Data: d4
## 
## REML criterion at convergence: 38.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -0.5642 -0.5259 -0.4173  0.2522  2.3525 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  FEMALE   (Intercept) 0.1877   0.4332  
##  Residual             0.3045   0.5518  
## Number of obs: 19, groups:  FEMALE, 10
## 
## Fixed effects:
##                                                Estimate Std. Error t value
## (Intercept)                                     0.39620    0.25490   1.554
## MALE.AGE.CLASS.IUnflanged                       0.07285    0.28727   0.254
## 
## Correlation of Fixed Effects:
##             (Intr)
## MALE.AGE.CL -0.610

I ran another ANOVA of the full model and the second recuded model.

Anova(reduced2, full, type = c("II", "III", 2, 3), test = "F")
## Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
## 
## Response: log(TOTAL.RESISTANCE)
##                       F Df Df.res Pr(>F)
## MALE.AGE.CLASS.I 0.0545  1 15.315 0.8185

This result is also different than what was found in the paper. It should be F(1,21.1) = 2.7, p = 0.117 (as reported in the first row and second column of Table 1).

Next I created new models for female resistant behaviors. These F-Statistics are reported in the second row of Table 1.

I began with a new full model, taking the log of the total number of resistant behaviors.

full <- lmer(data = d4, log(TOTAL.RESISTANCE) ~ FReproStatus + MALE.AGE.CLASS.I + (1 | FEMALE))
summary(full)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(TOTAL.RESISTANCE) ~ FReproStatus + MALE.AGE.CLASS.I + (1 |  
##     FEMALE)
##    Data: d4
## 
## REML criterion at convergence: 37.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -0.5315 -0.5285 -0.4127  0.2740  2.3289 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  FEMALE   (Intercept) 0.1847   0.4298  
##  Residual             0.3293   0.5738  
## Number of obs: 19, groups:  FEMALE, 10
## 
## Fixed effects:
##                                                Estimate Std. Error t value
## (Intercept)                                      0.3697     0.2902   1.274
## FReproStatusPOP                                  0.1084     0.4318   0.251
## MALE.AGE.CLASS.IUnflanged                        0.1037     0.3339   0.311
## 
## Correlation of Fixed Effects:
##             (Intr) FRSPOP
## FRprSttsPOP -0.444       
## MALE.AGE.CL -0.693  0.459

I created a reduced model in which only the female reproductive status is considered.

reduced1 <- lmer(data = d4, log(TOTAL.RESISTANCE) ~ FReproStatus + (1 | FEMALE))
summary(reduced1)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(TOTAL.RESISTANCE) ~ FReproStatus + (1 | FEMALE)
##    Data: d4
## 
## REML criterion at convergence: 37.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -0.5425 -0.5141 -0.4528  0.3610  2.3699 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  FEMALE   (Intercept) 0.1569   0.3961  
##  Residual             0.3212   0.5667  
## Number of obs: 19, groups:  FEMALE, 10
## 
## Fixed effects:
##                 Estimate Std. Error t value
## (Intercept)      0.43368    0.20033   2.165
## FReproStatusPOP  0.05085    0.37739   0.135
## 
## Correlation of Fixed Effects:
##             (Intr)
## FRprSttsPOP -0.206

I ran an ANOVA to compare these two models

Anova(reduced1, full, type = c("II", "III", 2, 3), test = "F")
## Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
## 
## Response: log(TOTAL.RESISTANCE)
##                   F Df Df.res Pr(>F)
## FReproStatus 0.0161  1 11.312 0.9012

This result is different than what was found in the paper. It should be F(2,42) = 4.2, p = 0.021.

I then created the second reduced model in which only male type is included.

reduced2 <- lmer(data = d4, log(TOTAL.RESISTANCE) ~ MALE.AGE.CLASS.I + (1 | FEMALE))
summary(reduced2)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(TOTAL.RESISTANCE) ~ MALE.AGE.CLASS.I + (1 | FEMALE)
##    Data: d4
## 
## REML criterion at convergence: 38.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -0.5642 -0.5259 -0.4173  0.2522  2.3525 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  FEMALE   (Intercept) 0.1877   0.4332  
##  Residual             0.3045   0.5518  
## Number of obs: 19, groups:  FEMALE, 10
## 
## Fixed effects:
##                                                Estimate Std. Error t value
## (Intercept)                                     0.39620    0.25490   1.554
## MALE.AGE.CLASS.IUnflanged                       0.07285    0.28727   0.254
## 
## Correlation of Fixed Effects:
##             (Intr)
## MALE.AGE.CL -0.610
Anova(reduced2, full, type = c("II", "III", 2, 3), test = "F")
## Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
## 
## Response: log(TOTAL.RESISTANCE)
##                       F Df Df.res Pr(>F)
## MALE.AGE.CLASS.I 0.0545  1 15.315 0.8185

This result is different than what was found in the paper. It should be F(1,42) = 2.7, p = 0.110.

I could not find the observations of male inspection behaviors in the data I was given, so was unable to attempt the replication of this.

Finally, I repeated the above steps for the male aggresive behaviors (the last row of Table 1).

full <- lmer(data = d4, log(MALE.AGGRESSION) ~ FReproStatus + MALE.AGE.CLASS.I + (1 | FEMALE))
summary(full)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(MALE.AGGRESSION) ~ FReproStatus + MALE.AGE.CLASS.I + (1 |  
##     FEMALE)
##    Data: d4
## 
## REML criterion at convergence: 42.5
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.41623 -0.87688 -0.03682  0.64080  1.51926 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  FEMALE   (Intercept) 0.0000   0.0000  
##  Residual             0.4394   0.6629  
## Number of obs: 22, groups:  FEMALE, 10
## 
## Fixed effects:
##                                                Estimate Std. Error t value
## (Intercept)                                      0.9388     0.2277   4.123
## FReproStatusPOP                                 -0.2457     0.4453  -0.552
## FReproStatusPregnant                            -0.8404     0.4956  -1.696
## MALE.AGE.CLASS.IUnflanged                       -0.1968     0.3046  -0.646
## 
## Correlation of Fixed Effects:
##             (Intr) FRSPOP FRprSP
## FRprSttsPOP -0.511              
## FRprSttsPrg -0.242  0.124       
## MALE.AGE.CL -0.708  0.362  0.018
reduced1 <- lmer(data = d4, log(MALE.AGGRESSION) ~ FReproStatus + (1 | FEMALE))
summary(reduced1)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(MALE.AGGRESSION) ~ FReproStatus + (1 | FEMALE)
##    Data: d4
## 
## REML criterion at convergence: 42.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.2788 -0.8507  0.0000  0.7351  1.7028 
## 
## Random effects:
##  Groups   Name        Variance  Std.Dev. 
##  FEMALE   (Intercept) 8.893e-18 2.982e-09
##  Residual             4.260e-01 6.527e-01
## Number of obs: 22, groups:  FEMALE, 10
## 
## Fixed effects:
##                      Estimate Std. Error t value
## (Intercept)            0.8346     0.1583   5.273
## FReproStatusPOP       -0.1414     0.4087  -0.346
## FReproStatusPregnant  -0.8346     0.4879  -1.711
## 
## Correlation of Fixed Effects:
##             (Intr) FRSPOP
## FRprSttsPOP -0.387       
## FRprSttsPrg -0.324  0.126

I used the Anova() function in the {car} package to obtain the F-Statistic.

library(car)
Anova(reduced1, full, type = c("II", "III", 2, 3), test = "F")
## Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
## 
## Response: log(MALE.AGGRESSION)
##                   F Df Df.res Pr(>F)
## FReproStatus 1.2051  2 17.516 0.3233

This result is different than what was found in the paper. It should be F(2,42) = 0, p = 0.966.

reduced2 <- lmer(data = d4, log(MALE.AGGRESSION) ~ MALE.AGE.CLASS.I + (1 | FEMALE))
summary(reduced2)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(MALE.AGGRESSION) ~ MALE.AGE.CLASS.I + (1 | FEMALE)
##    Data: d4
## 
## REML criterion at convergence: 46.1
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.18876 -0.96873 -0.05815  0.80154  1.67641 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  FEMALE   (Intercept) 0.0000   0.0000  
##  Residual             0.4613   0.6792  
## Number of obs: 22, groups:  FEMALE, 10
## 
## Fixed effects:
##                                                Estimate Std. Error t value
## (Intercept)                                      0.8074     0.1961   4.118
## MALE.AGE.CLASS.IUnflanged                       -0.1494     0.2908  -0.514
## 
## Correlation of Fixed Effects:
##             (Intr)
## MALE.AGE.CL -0.674
Anova(reduced2, full, type = c("II", "III", 2, 3), test = "F")
## Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)
## 
## Response: log(MALE.AGGRESSION)
##                       F Df Df.res Pr(>F)
## MALE.AGE.CLASS.I 0.2039  1 17.652 0.6571

This result is different than what was found in the paper. It should be F(1,42) = 5.1, p = 0.029.

I have tried endless variations of this code and still cannot figure out why I am not successfully replicating the analysis. While it is possible that I could have figured this out with more time, I have thought of a few possibilities of where I went wrong. I could be log-transforming the data incorrectly, I could be misinterpretting what Table 1 is meant to show, or I could be using the completely wrong spreadsheet of data. However, I have tried altering all of these factors, and am still unsuccessful. It is also possible that other effects went into the model (such as length of mating, number of pelvic thrusts, juvenile distress behaviors, or forced vs unforced mating) which were not properly explained in the methods section of the paper, and therefore I failed to include them. This is possible, as these variables are recorded in the dataset, though not explicitly mentioned in the paper.